Find the output of the following program:
Python3
geekCodes = [ 1 , 2 , 3 , 4 ]
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
Please comment below if you find anything wrong in the above post