python variable scope if code example
Example 1: python variable scope
a = 5
def f1():
a = 2
print(a)
print(a) # Will print 5
f1() # Will print 2
Example 2: are if statements their own scope python
In python variables created within if statments do not have their
own scope.
Example 3: how to use variables with if statements python
if choice == 'video games' or choice == 'Video Games' or choice == 'Video games' or choice == 'a)' or choice == 'a':