I am working with python and doing the following.
x = [1,2,3,4,5]
def function1():
print(x)
function1()
I would think that I would get the error name 'x' is not defined
but I do not, it prints the variable x even though it is not defined in the function. Why does python let me use variables that are defined outside of a function inside a function even though they have different scopes?