How to use a global variable for all class methods in Python?
<ul>
<li><p>I have a <code>Person</code> class, which holds an <code>age</code> property, now I need to make it accessible in all method inside <code>Person</code> class, so that all methods work properly</p></li>
<li><p>My code is as following:</p></li>
</ul>

<pre class="lang-py prettyprint-override"><code>class Person:
    #age = 0
    def __init__(self,initialAge):
        # Add some more code to run some checks on initialAge
        if(initialAge &lt; 0):
            print("Age is not valid, setting age to 0.")
            age = 0
        age = initialAge

    def amIOld(self):
        # Do some computations in here and print out the correct statement to the console
        if(age &lt; 13):
            print("You are young.")
        elif(age&gt;=13 and age&lt;18):
            print("You are a teenager.")
        else:
            print("You are old.")

    def yearPasses(self):
        # Increment the age of the person in here
        Person.age += 1 # I am having trouble with this method

t = int(input())
for i in range(0, t):
    age = int(input())         
    p = Person(age)  
    p.amIOld()
    for j in range(0, 3):
        p.yearPasses()       
    p.amIOld()
    print("")
</code></pre>

<ul>
<li><p><code>yearPasses()</code> is supposed to increase the <code>age</code> by 1, but now it doesn't do anything when called</p></li>
<li><p>How do I adapt it to make it work?</p></li>
</ul>