Important Python Mcqs

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

Answer:

d) all of the mentioned

Explanation:

list1 = list () 
list1 =[] 
list1 = list ([1, 2, 3]) 
print (type (list1)) 
print (type (list1)) 
print (type (list1)) 

<class ‘list’>
<class ‘list’>
<class ‘list’>

So all methods mentioned above will create a list.

Related MCQs
Aniket Malik

Aniket Malik

CERTIFIED TUTOR/TRAINER WITH 300+ REVIEWS

Facing difficulty with

this concept?