+ 2
Python - Why is output "None"?
lst = [].append(5) print (lst)
4 Answers
+ 6
lst=[]
lst.append(5)
print (lst)
Check this lesson about lists functions:
https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2433/
+ 3
If u wanna append any element in a list u should write this
lst=[]
lst.append(5)
print(lst)
Out put is [5]
+ 1
Append will only modify the original list.
So the original list in your example is []..
lst will receive the Return value of append method, which is "None".
To get correct result, use jesus' solution...