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 aloneShared 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
The program picks a random secret number.
The player enters guesses one at a time.
The program says whether the guess is too high, too low, or correct.
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
Step 1
Ask for the first guess
Use input() to ask the player for a number, then convert it to an integer.
- 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.
- 3
Step 3
Give feedback
Inside the loop, print a different message for guesses that are too low and too high.
- 4
Step 4
Count the attempts
Increase guess_count every time the player makes a guess.
- 5
Step 5
Finish the game
When the loop ends, print a success message showing how many guesses were needed.
More to explore
Want a different challenge?
Browse more guided projects, or come back and start this one whenever you are ready.