The Python interpreter executes the following steps:
def f(x): return y**2 a = 3 # here both a and f are defined
You can run the preceding program because there are no syntactical errors. You get an error only when you call the function f
.
f(2) # error, y is not defined
3.129.218.45