+ 1

How range() works with negative step?

31st Aug 2021, 12:29 PM
Aniket Gupta
Aniket Gupta - avatar
4 Respuestas
+ 4
//range(start, stop, step) print(list(range(0,-10,-1)))
31st Aug 2021, 12:50 PM
SAN
SAN - avatar
31st Aug 2021, 4:24 PM
Aniket Gupta
Aniket Gupta - avatar
0
Invalid error
31st Aug 2021, 1:54 PM
Aniket Gupta
Aniket Gupta - avatar
0
Hi Aniket! San's code is working fine. Please check it again. You may miss something. Alternatively, you can try like this print(list(range(10,0,-1)))
31st Aug 2021, 4:22 PM
Python Learner
Python Learner - avatar