Unit 2 Task 24: Guess with seven tries

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

Unit 2 Task 24 - Guess with seven tries

← Unit 2 tasks · Solution


Pick a secret number from 1 to 50 with random.randint(1, 50). The player has at most 7 guesses.

Still give Too high / Too low hints after each wrong guess.

Skills: for over range(7) with break, or while with guess count.