Class - 12 CBSE Computer Science Important Output Questions 2025
How many times will the following for loop execute and what's the output?
for i in range(-1, 7, -2):
for j in range (3):
print(1, j)
Python
Python Funda
67 Likes
Answer
The loops execute 0 times and the code produces no output. range(-1, 7, -2) returns an empty sequence as there are no numbers that start at -1 and go till 6 decrementing by -2. Due to empty sequence, the loops don't execute.
Answered By
25 Likes