title: Restart option in Guess The Number in Python
body: <p>I am having a hard time wiht this Guess The Number assignment. I can't seem to get it right and would like some help. The play again option isn't working because when you win the game and choose yes to play again it doesn't restart the game it continues on your next guess number (example: guess number 1, guess number 2...). But when you lose it goes back to the first part where it asks you "How many tries you would like". So how can I get the part where you win to do that? Also, can someone give me some tips on how to improve the hint option? Also, do I need to insert any of that <em>def main():</em> stuff? Because I'm not sure if we got to that point yet for this assignment. So please help me out. Thanks.</p>
  
  <pre><code># This is a guess the number game.
  import random
  answer = "yes"
  number = random.randint(1, 10)
  
  while answer == 'yes':
      tries = 0
      guess = 0
      guessnumber = 0
      tries = int(input("How many tries would you like? "))
      tries2 = tries
      while guessnumber != tries2:
              guessnumber += 1
              guess = int(input("Enter guess number " + str(guessnumber) + ": "))
              if guess &lt; number:
                  print("You guessed too low")
                  hint = input("Would you like a hint, yes or no?: ")
                  if hint == "no":
                      continue
                      print("The number is less than", number + 1)
                  if guess &gt; number:
                      print("You guessed too high")
                      hint = input("Would you like a hint, yes or no?: ")
                      if hint == "no":
                          continue
                      print("The number is greater than", number - 1)
                  if guess == number:
                      tries = str(tries)
                      print("YOU WON!")
                      answer = input("Play again? Yes/No? ") `enter code here`
                      if answer == 'no':
                          break
              if guess != number:
                  number = str(number)
                  print("GAME OVER!!! The number I was thinking of was " + number)
                  answer = input("Play again? Yes/No? ")
                  if answer == "no":
                      break
  </code></pre>