Practice exercise

Just wanted to point out that pages 2/14 and 3/14 are the same

https://app.dataquest.io/m/1012/python-fundamentals-practice-problems/3/understanding-function-scope-2

Nope, they are not. One function returns something and the other does not.

This, on 2/14:

x = []

def f():
    x = []
    x.append(1)
    x.append(2)
    x.append(3)
    return x

f()
print(x)

Is different from this, on 3/14:

x = []

def f():
    x = []
    x.append(1)
    x.append(2)
    x.append(3)

f()
print(x)

Oops ok, I didn’t realize. Thank you

1 Like