Question Detail
Question
In the 'Guess the Number Game Python Code' example, why is
while True: used?
Correct Answer
Option C is the correct answer.
Detailed Explanation
Page 12 and 13 show
while True: combined with an if guess == secret_number: break structure. This setup creates a loop that would run indefinitely (as True is always true) until the break statement is encountered when the correct guess is made.
Hint
Consider the effect of
True as a condition and how the break statement is used in conjunction with it to provide an exit.