Error; Variable Referenced Before Assignment
<p>I'm getting an <code>Error; Variable Referenced Before Assignment</code> for myhp.
At the starting of my .py file, I have "myhp = 20" though.</p>

<p>What do I do to get this working?</p>

<pre><code>def fightmode(name, hp, dmg, gold):
    print '\n\n\nYou are in a fight with %s' %name
    print '%s has %sHP' %(name, hp)
    while myhp &gt; 0 and hp &gt; 0:
        print '\n\t1. Attack \n\t2. Guard \n\t3. Run away.'
        opt1= ''
        allowed = ["1", "2", "3"]
        while opt1 not in allowed:
            opt1 = raw_input("\nWhat will you do? ")
            if opt1 == "1":
                hp = hp - mydmg
                print "You have inflicted %d damage on %s. %s's HP is %s" %(mydmg, name, name, hp)
            if opt1 == "2":
                myhp = myhp+5
                print "You are now guarding yourself. Your HP is now %d" %myhp
</code></pre>
