Introduction
The for loop
The while loop
Nested loops
break and continue
Summary
22. Exercise 2

Instruction

Well done! Give this one a shot.

Exercise

Keep asking the user to guess a secret number until they get it right. The secret number is 8. If the user's answer is greater than 8, print:

Too big!

If the answer is less than 8, print:

Too small!

If the answer is 8, use a break statement to leave the loop and print:

Correct!