Quiz Question 1 of 5
Examine the following mixed loop construct. What will be the output, and what does the reset of i
to 0 after the inner loop signify in terms of loop control and output consistency?
numbers = [12, 5, 3]
i = 0
for n in numbers:
while i < n:
print(i, end = " ")
i += 2
i = 0
print()
Choose the correct answer below:
-
A
The output will only print even numbers up to the first element of the list.
-
B
The output will print even numbers up to each list value, resetting for each new list item.
-
C
The output will be a sequence of even numbers from 0 up to the largest number in the list.
-
D
The loop will result in an infinite loop due to resetting
i
.