Class - 12 CBSE Computer Science Important Output Questions 2025
Write the output of the following:
for x in range(10, 20):
if (x % 2 == 0):
continue
print(x)
Python
Python Control Flow
5 Likes
Answer
19
Working
In the provided code, a for
loop iterates over a range of numbers from 10 to 19. Within the loop, an if
statement checks if the current value of x
is even (divisible by 2) using the modulo operator '%'. If x
is even, the continue
statement is executed, causing the loop to skip the rest of the code in that iteration and move to the next iteration. As a result, only odd numbers in the range 10 to 19 will be considered. After the loop completes, the value of x
will be the last value of the iteration, which is 19. Therefore, the output of the code will be 19.
Answered By
1 Like