CBSE Class 11 Informatics Practices Question 20 of 40

Practice Paper — Question 2

Back to all questions
2
Question

Question 20

What will be the output of the following code?

for k in range(-10, 0, 2):  
    print(k)
Answer
Output
-10
-8
-6
-4
-2
Explanation

The for loop generates a sequence of numbers starting from -10, stopping before 0 (i.e., 2), and incrementing by 2 each time, resulting in the sequence -10, -8, -6, -4, -2.