4.1.3 - The Guessing Game

Copy the following code to Thonny and save it as Guess.


We will play the game together and try to explain the steps using the Debug button. Input only integer numbers.

  • Can you improve the program so in every attempt shows how many guesses you have left? Add the following lines after line 16. Don't forget the indentation


guesses_left = 7 - guesses_taken print("You have " + str(guesses_left) + " tries.")


  • Can you cheat to win every time in the first guess?
  • What happens if your guess is not integer?