Skip to content
Related Articles

Related Articles

Python-Quizzes | Python List Quiz | Question 3
  • Last Updated : 17 Sep, 2020
GeeksforGeeks - Summer Carnival Banner

Question 3: Find the output of the following program:




geekCodes = [1, 2, 3, 4
  
# List will look like as [1,2,3,4,[5,6,7,8]] 
geekCodes.append([5,6,7,8]) 
  
print(geekCodes) 

(A) [1,2,3,4,5,6,7,8]
(B) [1,2,3,4]
(C) [1,2,3,4,[5,6,7,8]]
(D) [1,2,3,4][5,6,7,8]


Answer: (C)

Explanation: The task of the append() method is to append a passed obj into an existing list. But instead of passing a list to the append method will not merge the two lists, the entire list which is passed is added as an element of the list.

Quiz of this Question

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up
Recommended Articles
Page :