KnowledgeBoat Logo
|

Informatics Practices

Which of the following commands will create a list?

  1. List1=list ()
  2. List1= []
  3. List1=[1,2,3,"a"]
  4. All of these

Python List Manipulation

1 Like

Answer

All of these

Reason — All of the provided commands will create a list in Python:

  1. List1=list() initializes an empty list using the list constructor.
  2. List1=[] directly initializes an empty list using square brackets.
  3. List1=[1, 2, 3, "a"] initializes a list with mixed data types including integers and a string.

Answered By

1 Like


Related Questions