Unit 2 Task 46: Guess my number with play again

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

Unit 2 Task 46 - Guess my number with play again

โ† Unit 2 tasks ยท Solution


Combine loops: an outer loop asks if the player wants another round (y / n). An inner loop plays one full game (secret 1โ€“20, too high / too low until correct).

Skills: nested while, break only inner loop, string check for play again.

Keep the range 1โ€“20 so rounds are quick.