Accessing and altering a variable across classes


I am currently on Ex 45, making my own game. I am trying to build in a guess system, where if you guess incorrectly 10 times across the whole game, you lose. How do I get a class to access this variable, alter it and hand it off to the next class?


You probably want to use the global keyword:


def somefunc():
    global THE_STATE
    THE_STATE = 1000

That will change the variable.