I get the error
How often? 33
Traceback (most recent call last):
File "main.py", line 20, in <module>
main()
File "main.py", line 17, in main
won += 1
UnboundLocalError: local variable 'won' referenced before assignment
when I try to run the following code:
teller = 0
throw = int(input('How often?'))
won = 0
def main():
pricedoor = round (3 * np.random.rand() + 0.5)
if pricedoor == 4 : pricedoor = 3
choicedoor = round (3 * np.random.rand() + 0.5)
if choicedoor == 4 : choicedoor = 3
sheepdoor = mf.quizmasteropens(pricedoor, choicedoor)
#choicedoor = choicedoor
if choicedoor == pricedoor:
won += 1
while teller < throw :
main()
teller = teller + 1
How can I fix this problem? Thanks in advance for the help!