For num in range (0,10,-2): print (num,end=' ') .why no output for this one and for this one also for num in range (10,0,2) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

For num in range (0,10,-2): print (num,end=' ') .why no output for this one and for this one also for num in range (10,0,2)

Python

18th Jan 2023, 9:30 AM
janvi vashistha
1 Answer
+ 5
The parameters of the range function are range(start, stop, step). If you step -2 from zero, you are out of the range [0; 10), hence not output. Please do NOT put code in the title section, it gets cut off. Please put your code in a script on sololearn playground and LINK your code.
18th Jan 2023, 10:28 AM
Lisa
Lisa - avatar