getting a nameerror in python. while two other name is working, one name is not working..!
<p>I'm a beginner in Python; if I write this code it shows:</p>

<pre><code> Traceback (most recent call last):
  File "C:/Python32/ultimate tym remaining.py", line 37, in &lt;module&gt;
    print("so the reamining time is %d hour, %d minutes and %d seconds" %(hr,minr,sr))
 NameError: name 'minr' is not defined 
</code></pre>

<p>My code was:</p>

<pre><code>hg=12
mg=00
sg=00
hn=10
mn=47
sn=49

if(mg&gt;mn &amp; hg&gt;hn):
    hr=hn+24-hn-1
elif(mg&lt;mn &amp; hg&gt;hn):
    hr=hn+24-hg
elif(mg&gt;mn &amp; hg&lt;hn):
    hr=hn-hg-1
elif(mg&lt;mn &amp; hg&lt;hn):
    hr=hn-hg
elif(hg==hn):
    hr=0

if(sg&lt;sn &amp; mg&gt;mn):
    minr=mn+60-mg
elif(sg&lt;sn &amp; mg&lt;mn):
    minr= mn-mg
elif(sg&gt;sn &amp; mg&gt;mn):
    minr=mn+60-mg-1
elif(sg&gt;sn &amp; mg&lt;mn):
    minr=mn-mg-1
elif(mg==mn):
    minr=0

if(sg&gt;sn):
    sr=sn+60-sg
elif(sg&lt;sn):
    sr=sn-sg
elif(sf==ss):
    sr=0

print("so the reamining time is %d hour, %d minutes and %d seconds" %(hr,minr,sr))
</code></pre>

<p>Why is this happening? Why are <code>hr</code> and <code>sr</code> working and <code>minr</code> is not?</p>
