title: how to count the number of user inputs in Python
body: <p>Im having loads of trouble trying to count the number of guesses in this after you find the number.</p>
  
  <pre><code>def play_game():
      print("Enter the upper limit for the range of numbers: ")
      limit = int(input())
      number = random.randint(1, limit)
      print("I'm thinking of a number from 1 to " + str(limit) + "\n")
      while True:
          guess = int(input("Your guess: "))
          if guess &lt; number:
              print("Too low.")
          elif guess &gt; number:
              print("Too high.")
          elif guess == number:
              print("You guessed it in " + str(count) + " tries.\n")
              return
  </code></pre>