title: Python Why does my code result in an infinite loop?
body: <p>So, I am learning Python 3. I tried writing a script that asks you to guess a number from 1 to 20.
  Now I know that this is not the best way of doing it, but when I run the code it goes into an infinite loop.
  What causes that? What did I do wrong? The purpose of my question is to understand my mistake and the process that leads to that. 
  Thank you guys.</p>
  
  <pre><code># Defining the function inside which the verification happens
  def guesst(secretNumber, inputNumber):
      numberOfGuesses = 0
      if inputNumber &gt;= 1 and inputNumber &lt;= 20:
          while inputNumber:
              if inputNumber &gt; secretNumber:
                  numberOfGuesses += 1
                  print('Your guess is too high.')
              elif inputNumber &lt; secretNumber:
                  numberOfGuesses += 1
                  print('Your guess is too low.')
              elif inputNumber == secretNumber:
                  print('Your guess is correct, congratulations! You\'ve my number in ', numberOfGuesses, 'guesses.')
                  break
      else:
          print('Please enter a number between 1 and 20')
  
  # Defining the variables used by the function
  secretNumber = 11
  inputNumber = int(input('I\'m thinking of a number between 1 and 20, try to guess which one: '))
  
  # Calling in the function
  guesst(secretNumber, inputNumber)
  
  # -------------------------------------------------------
  # I just changed my code to this and it worked, thank you!
  # -------------------------------------------------------
  
  def guesstt(secretNumber):
      numberOfGuesses = 0
      while secretNumber:
          inputNumber = int(input('I\'m thinking of a number between 1 and 20, try to guess which one: '))
          if inputNumber &gt;= 1 and inputNumber &lt;= 20:
              if inputNumber &gt; secretNumber:
                  numberOfGuesses += 1
                  print('Your guess is too high.')
              elif inputNumber &lt; secretNumber:
                  numberOfGuesses += 1
                  print('Your guess is too low.')
              elif inputNumber == secretNumber:
                  print('Your guess is correct, congratulations! You\'ve my number in ', numberOfGuesses, 'guesses.')
                  break
          else:
              print('Please enter a number between 1 and 20')
  
  secretNumber = 11
  guesstt(secretNumber)
  </code></pre>