Class - 12 CBSE Computer Science Important Output Questions 2025
Write the output of the following:
for j in range(10, 6, -2):
print(j*2)
Python
Python Control Flow
4 Likes
Answer
20
16
Working
The range(10, 6, -2)
function creates a range starting from 10 and decrementing by 2 until it reaches 6 (but does not include 6), resulting in the sequence [10, 8]. The for j in range(10, 6, -2):
statement sets up a for loop that iterates over each element in the generated sequence [10, 8]. During each iteration of the loop, the print(j*2)
statement prints the value of j
multiplied by 2.
Answered By
1 Like