python variable scopes code example
Example 1: how does scope work in python
a = 5
b = 3
def f1():
a = 2
print(a)
print(b)
print(a) # Will print 5
f1() # Will print 2 and 3
Example 2: python variable scope
a = 5
def f1():
a = 2
print(a)
print(a) # Will print 5
f1() # Will print 2