Stack Exchange
Stack Overflow
Questions
Tags
Users
About
Stack Overflow
Public
Questions
Tags
Users
About
None output in the assignments of lists
Asked
Oct 26 '16 at 20:40
Active
Sep 14 '22 at 12:43
Viewed
27 times
0
a = [1,2,3] x=a.append(2009) print (x)
Output is :
None
What is the main reason of it ?
python
edited Feb 13 '19 at 04:05
Cœur
37,241
25
195
267
asked Oct 26 '16 at 20:40
Gingerbread
53
1
4
9
`append` returns None...
–
Andrew Li
Oct 26 '16 at 20:40
1
The reason is that `append` modifies the list in place and returns None. Search to find gazillions of other questions about this on here.
–
BrenBarn
Oct 26 '16 at 20:40
0 Answers
0