Question Detail

BIO 107 While Loops & Control Flow Objective Question

Question

In the ATM Security Check example, the while pin != '1234': loop continues to run. What specifically makes this loop 'run forever until the correct PIN is entered'?
Options
A The <code>pin</code> variable is never updated inside the loop.
B The <code>input()</code> function automatically repeats until a valid number is entered.
C The <code>!=</code> operator means the loop continues as long as the PIN is <i>not</i> '1234'.
Correct Answer
D There is no <code>break</code> statement in the loop.
Correct Answer

Option C is the correct answer.

Detailed Explanation

The condition pin != '1234' evaluates to True if the pin entered by the user is any value other than '1234'. The loop repeats, prompting for input, as long as this condition remains True. The pin is updated by input() within the loop.

Hint

Focus on the meaning of the != operator (not equal to) in the while condition and how it evaluates each time.

Question Info