Using continue in a try and except inside while-loop
<pre><code>try:
     num=float(num)
except:
     print "Invalid input"
     continue
</code></pre>

<p>this part of my code seems to be bugging, but when i remove the try and except everything works smoothly, so this seems to be the problem.</p>

<p>i want to convert the input inside a while loop to an integer, if the input isn't an integer it'll display an error and just continue with the loop and ask again. however, it doesn't continue the loop and just keeps printing "Invalid input" forever. how come it isn't continuing the loop?</p>

<p>here is the entire code, in case something else might be wrong:</p>

<pre><code>c=0
num2=0
num=raw_input("Enter a number.")
while num!=str("done"):
     try:
          num=float(num)
     except:
          print "Invalid input"
          continue
     c=c+1
     num2=num+num2      
     num=raw_input("Enter a number.")
avg=num2/c
print num2, "\t", c, "\t", avg
</code></pre>