What is the output of the following code ?
>>> s = [19, 12, 87] >>> s.append([56]) >>> s.extend([87, 12]) >>> s
[19, 12, 87, 56, 87, 12]
[19, 12, 87, 56, [87, 12]]
[19, 12, 87, [56], 87, 12]
Error
s.append([56]) will add [56] which is a list to "s" , and s.extend([87, 12]) will add individual elements 87 and 12 to "s".
So the result will be [19, 12, 87, [56], 87, 12]
Comment here: