Joseph Quigley <cpu.crazy <at> gmail.com> writes:
> I also can't get the counter to save the added or removed money. every time
> I play again, I always have $100
Without reading all the code (there might be other issues) I've snipped the
parts of the code away which are not interesting to this question, which
highlights the cause:
def play_again():
crapps()
def crapps():
while loop:
total_cash = 100
if total > total_2:
total_cash = total_cash + 10
play_again()
else:
total_cash = total_cash - 10
play_again()
total_cash is a local variable in the crapps function and is reset to 100 at the
start of every loop. Move this initialization to a different place (I'm not sure
when exactly you want to reset it as I don't know your intentions, but perhaps
before the loop, or make it a global variable and only initialize it at the
start of the program).
Yours,
Andrei
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor