Question Detail
Question
In Python, when can the
else statement be used in conjunction with a loop (for or while)?
Correct Answer
Option B is the correct answer.
Detailed Explanation
Page 84 states: 'else can be used in for and while loops the else body will be executed as and when the loop’s conditional expression evaluates to false.'
Hint
The
else block in a loop is typically executed if the loop completes normally, without a break.