title: Guess My number game with limited number of guesses
body: <p>I'm new to python and I'm trying to make the guess my number game with a limit of only 5 guesses, everything I've tried so far has failed. how can I do it?, I forgot to mention that I wanted the program to display a message when the player uses all their guesses.The code below only prints the "You guessed it" part after the 5 guesses whether they guess it or not. </p>
  
  <pre><code>import random
  print ("welcome to the guess my number hardcore edition ")
  
  print ("In this program you only get 5 guesses\n")
  
  print ("good luck")
  
  the_number = random.randint(1, 100)
  
  user = int(input("What's the number?"))
  
  count = 1
  while user != the_number:
  
      if user &gt; the_number:
       print ("Lower")
  
      elif user &lt; the_number:
       print ("Higher")
  
      user = int(input("What's the number?"))
      count += 1
      if count == 5:
       break
  
  
  print("You guessed it!!, the number is", the_number, "and it only"\
         " took you", count , "tries")
  
  input ("\nPress enter to exit")             
  </code></pre>