CodeAgeBy Sitezack
Python for Builders — Level 3Decisions and repetitions0 XP
Chapter progress0/6

Lesson 7 of 7

Project: Guess the number

Your first real game! The program knows a secret number and answers every guess: + if it's too small, - if it's too big, = when it's right.

You'll combine the whole chapter: for loop, if/elif/else and break. Take your time, line by line.

for guess in guesses:
    if guess < secret:
        print("+")

🎯 Your mission

The secret number is secret = 62 and the player tries guesses = [50, 80, 60, 62, 70]. Walk through guesses counting attempts in tries: print + if the guess is too small, - if it's too big, and = when it's found — then stop the loop with break. At the end, print tries.

PRO lesson

This advanced chapter is part of CodeAge PRO. Unlock it to keep your adventure going.

Discover PRO