Knowee
Questions
Features
Study Tools

Which of the following statement will create list?L1=list( )L1=[1,2,3,4]Both of the above

Question

Which of the following statement will create list?L1=list( )L1=[1,2,3,4]Both of the above

🧐 Not the exact question you are looking for?Go ask a question

Solution

Both of the above statements will create a list in Python.

  1. L1=list() : This statement creates an empty list named L1. The list() function generates a list.

  2. L1=[1,2,3,4] : This statement creates a list named L1 that contains four elements: 1, 2, 3, and 4. In Python, square brackets are used to define a list.

Similar Questions

1. Which of the following commands will create a list?a) list1 = list()b) list1 = []c) list1 = list([1, 2, 3])d) all of the mentioned

Which of the following would give an error?list1=[]list1=[]*3list1=[2,8,7]None of the above

Which of the following commands will create a list?infoYou have max 2 attempts to score in this question.Attempts left:2/2OptionsThis problem has only one correct answerlist1 = list()list1 = []list1 = list([1, 2, 3])all of the mentioned

What do these 3 lines print?>>> l1 = [1, 2, 3]>>> l2 = [1, 2, 3] >>> print(l1 is l2)

Which of the following is/are true statement(s)? Lists are used to store multiple values. One can access element in list by using non-numeric indices. Iterating over lists is possible in Python. We need to specify required size of list while creating a new list variable.

1/3

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.