4th Apr 2020, 6:45 PM
HAMZA
2 Answers
+ 1
If the range is from 50 to 100 then you can only move +5 to print values in intervals of 5 which are in range. You cannot use -5 because then it would give 45, which is not in the range. Either remove -ve sign. OR for x in range(100,50,-5): print(x) This will print 95 to 55 in intervals of 5.
4th Apr 2020, 6:52 PM
Avinesh
Avinesh - avatar
+ 1
range(50,100,-5) means the range start from 50 to 100 by moving backwards 5 step since the number id dcreasing,there is no way u can go from 50 to 100 maybe what u want to do is range(100,50,-5)
4th Apr 2020, 6:53 PM
durian
durian - avatar