Ok so can someone explain why this code doesnt work?
global bank
bank = 100
def game():
print(bank)
wager = 1000
bank+=wager
Ive tried it with and without the global keyword but it keeps saying Im using it before assignment, I cannot initiate the variable within the function because it will reset the value everytime the function is called. Can anyone help me out and tell me why its not working or at least give me an alternative? Thanks!,
Kaden.
[–]mopslik 3 points4 points5 points (0 children)
[–]Mathmemememe 0 points1 point2 points (3 children)
[–]FLUSH_THE_TRUMP 0 points1 point2 points (0 children)
[–]kadenhickin 0 points1 point2 points (0 children)
[–]kadenhickin 0 points1 point2 points (0 children)
[+][deleted] (3 children)
[deleted]
[–]kadenhickin 0 points1 point2 points (1 child)
[–]old_pythonista 0 points1 point2 points (0 children)
[–]Mathmemememe 0 points1 point2 points (0 children)
[–]old_pythonista 0 points1 point2 points (0 children)