Python-Quizzes | Python List Quiz | Question 3
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



