Start building now

Choose how you want to begin this project.

Open it privately for practice or create a shared workspace to build it together.

No setup required • Guided steps inside the editor

Private practice

Open a private editor and work through the steps at your own pace.

Start project alone

Shared workspace

Create a live session so you can teach, pair, or build the project together.

What you'll build

A game where the player keeps guessing until they find the secret number.

What you'll learn

  • How to use input and integer conversion
  • How to repeat code with a loop
  • How to use if statements for feedback
  • How to track progress with a counter

How it works

1

The program picks a random secret number.

2

The player enters guesses one at a time.

3

The program says whether the guess is too high, too low, or correct.

4

The game ends when the correct number is guessed.

Build path

These steps appear inside the editor so you can build one part at a time.

  1. 1

    Step 1

    Ask for the first guess

    Use input() to ask the player for a number, then convert it to an integer.

    Complete in the editorHint availableSolution available
  2. 2

    Step 2

    Repeat until the guess is correct

    Use a while loop so the game continues while the guess is not equal to the secret number.

    Complete in the editorHint available
  3. 3

    Step 3

    Give feedback

    Inside the loop, print a different message for guesses that are too low and too high.

    Complete in the editorHint available
  4. 4

    Step 4

    Count the attempts

    Increase guess_count every time the player makes a guess.

    Complete in the editorHint available
  5. 5

    Step 5

    Finish the game

    When the loop ends, print a success message showing how many guesses were needed.

    Complete in the editorHint available

More to explore

Browse more guided projects, or come back and start this one whenever you are ready.