+ 1

What should be the output of given append op.

list=[] list. append([].append(2)) i thought output will came as [[2]] but it gives [None] ??

3rd Aug 2018, 6:12 AM
Sandeep Kumar Suthar
3 Answers
+ 1
list=[] list.append([]) list[0].append(2) try this, the append function doesn't return anything so you have to use it like this
3rd Aug 2018, 6:27 AM
hinanawi
hinanawi - avatar
+ 1
the append function returns none so what you're doing is list.append(none)
3rd Aug 2018, 6:17 AM
JME
+ 1
thanks!!
3rd Aug 2018, 6:37 AM
Sandeep Kumar Suthar