Q:

Why does line 1 print [1,2,3,"a"], and not just [1,2,3]? is it because of the L2=f2(L1,'a')? HOW?

def f1(v,y):
      v = 4
      y += v
      return y

def f2(L,x):
    L.append(x)
    return L
L1 = [1,2,3]
L2 = `f2(L1,'a')`
print(L1)    # Line 1
print(L2)    # Line 2
a = 2
b = 3
c = f1(a,b)
print(a)     # Line 3
print(c)     # Line 4
print( f1(L1,1) )  # Line 5

Why does line 1 print [1,2,3,"a"], and not just [1,2,3]?
Is it because of the L2=f2(L1,'a')? HOW?

A:

That is because, while passing the argument L1 to function f2, pointer of a variable is passed. Therefore, when you append a value to variable L inside your function, the list L1 is also modified(L is nothing but a pointer to L1)

if a function modifies an object passed as an argument, the caller
  will see the change

Take a look at this
Therefore is it beacuse of the L2=f2(L1,'a')? yes
Hope it helps!

