Exercise - Create a guess the number game

Completed

In this exercise, you build a Guess the Number game. The program picks a random number and uses a while loop to keep asking the player to guess until they get it right.

Launch the exercise and follow the instructions.

Button that launches the Guess the Number Python exercise in a new browser tab.

Extend with GitHub Copilot

After completing the exercise, try extending your game with GitHub Copilot:

  • Ask Copilot to add a guess counter that tells the player how many attempts they used.
  • Ask Copilot to add difficulty levels that change the range of the random number.

Review each suggestion carefully before accepting it—make sure you understand what the code does and that it behaves the way you expect.