I have code that looks similar to this
v = '0'
def program():
x = input('1 or 2 ')
if x == '1':
print('it is 1')
v = '1'
elif x == '2':
print('it is 2')
v = '2'
while True:
program()
print(v)
However, when I run this code the variable 'v' always prints out the default 0. Why isn't it giving me the variable I assigned it in the function?