Skip to content
Related Articles
Open in App
Not now

Related Articles

Python-Quizzes | Python List Quiz | Question 3

Improve Article
Save Article
  • Last Updated : 17 Sep, 2020
Improve Article
Save Article

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

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!