- #1
Kolika28
- 146
- 28
- TL;DR Summary
- I don't understand why the first code won't change the list x, while the second code does change the list. Could someone explain?
Python:
#Code nr.1
x=[1,2]
def double(l):
return [a*2 for a in l]
double(x)
print(x)
#Code nr.2
def f(x):
x[0]=x[0]+1
return x
x=[3]
f(x)
print(x)