Informatics Practices

What will be the output of the following code?

for k in range(-10, 0, 2):  
    print(k)

Python Control Flow

3 Likes

Answer

-10
-8
-6
-4
-2

Working

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.

Answered By

1 Like


Related Questions