Computer Science

Predict the output of the following code fragments:

for q in range(100, 50, -10):
   print (q)

Python

Python Control Flow

9 Likes

Answer

100
90
80
70
60

Working

range(100, 50, -10) will generate a sequence like this [100, 90, 80, 70, 60]. q will be assigned each of the values from this sequence one by one and that will get printed.

Answered By

3 Likes


Related Questions