So I want to make a simple loop program but I have a problem:
def Lottery():
Cash = 200
YourNumber = randint(1, 10)
while YourNumber != WinningNumber:
Cash = Cash - 10
if Cash < 0:
print("You are out of money!")
break
YourNumber = randint(1, 10)
else:
Cash = Cash + 100
Lottery()
The problem is that in the last line of the def the "cash" will automatically reset to 200 again when restarting the loop. Maybe there is a really simple solution for this, but I've googled and tried without any results.