+ 1
Python - Why is result "None"?
A = [1,2] B = [3,4] C = A.extend(B) print(C)
4 odpowiedzi
+ 3
"Extend" method does a work but returns nothing. So C becomes None.
An example:
def func (x,y):
x =x+y
This function returns nothing to it's caller but does a work and changes it's arguments.
+ 2
Here's a very good explanation about your problem
https://stackoverflow.com/a/29998477
+ 1
You right! If after print(C) I write print(A), it outputs [1,2,3,4]