How would you initialize an empty list in Python?

  • empty_list = []
  • empty_list = [None]
  • empty_list = {}
  • empty_list = None
To initialize an empty list in Python, you use square brackets []. Option 2 initializes an empty dictionary, option 3 initializes a variable as None, and option 4 initializes a list with a single element, which is None.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *