Advertisements
Advertisements
Question
Find the output of the following program segment:
for i in range(20,30,2):
print(i)Short/Brief Note
Advertisements
Solution
The range(start, stop, step) function will create a list from the start value to the stop value(excluding the stop value) with a difference in the step value.
The list thus created will be [20, 22, 24, 26, 28].
OUTPUT:
20
22
24
26
28
shaalaa.com
Is there an error in this question or solution?
Chapter 6: Flow of Control - Exercise [Page 140]
