Question Detail
Question
Consider the following Python code snippet:
What will be the output of this code?
count = 0while count >= 10: count += 1print(count)What will be the output of this code?
Correct Answer
Option A is the correct answer.
Detailed Explanation
The
while loop condition count >= 10 is evaluated with count initially set to 0. Since 0 >= 10 is False, the loop body (count += 1) is never executed. The program then proceeds to print(count), which outputs the initial value of count, which is 0.
Hint
Pay close attention to the initial value of `count` and the condition of the `while` loop.