Unit 2 Task 15: Higher–lower guessing game

Learn to code with step-by-step lessons. A place for students to work through programming fundamentals and build skills.

Unit 2 Task 15 - Higher–lower guessing game

← Unit 2 tasks · Solution


The computer chooses a secret integer from 1 to 100 with random.randint(1, 100). The player keeps guessing until they get it right.

After each guess:

Use while True and break when correct.

Skills: random, nested conditionals, loop + input + int.