input: Write a function to list the contents of a directory. The function should take an optional path as an argument and return a list of files and directories within that path. If no path is provided, it should use the current directory. Include assert tests to validate the function.
  assert list_directory_contents() == os.listdir()
  assert list_directory_contents('/home/user') == os.listdir('/home/user')
  assert list_directory_contents('/nonexistent') == []
output: def list_directory_contents(path=None):
      if path is None:
          path = os.getcwd()
      try:
          return os.listdir(path)
      except FileNotFoundError:
          return []