Handling null inputs for countdown timer: invalid literal for int() with base 10: ''
<p>I've just started out Python and was trying to make a countdown timer and make it unbreakable as possible, however when I enter blank inputs, the while loop won't handle it, and this message would show up instead: invalid literal for int() with base 10: ''. It also pointed the error occurring at the line where it asks for count-down.</p>

<p>Any help will be appreciated.</p>

<pre><code>while countdown == 0 or countdown == "": 
      print("We need a person to countdown.") 
      countdown = int(input("How many seconds would you like the countdown to be?: ")) 
  while countdown &gt; 30: 
      try: 
          countdown = int(input("Enter non-extreme values please: ")) 
      except ValueError: 
          print("Enter possible value.") 
  while countdown &gt; 0: #Countdown sequence
      time.sleep(2) 
      countdown -= 1 
      print(countdown) 
  print("BLASTTT OFFFFFFFFFFFFFF!!!") 
  print("We have a liftoff...") 
</code></pre>

<p>A bad string that can not be converted to an int, will raise a ValueError. You catch that exception and just repeat the prompt like this:</p>

<pre><code>countdown = 0
while countdown &lt;= 0:
    try:
        countdown = int(input("How many seconds would you like the countdown to be?: "))
    except ValueError:
        pass
</code></pre>

<p>As soon as a proper integer > 0 has been entered the <code>while</code> will break.</p>

python input while-loop countdown