+ 1

How can i

run for loop in python from 20 to 1

23rd Sep 2017, 7:14 PM
yash gupta
yash gupta - avatar
3 Answers
+ 4
for i in range(20,0,-1): print(i)
23rd Sep 2017, 7:37 PM
LordHill
LordHill - avatar
+ 3
Another way print(list(range(20, 0, -1))) #one line or number = list(range(20, 0, -1)) #two lines print(number)
23rd Sep 2017, 7:56 PM
Ferhat Sevim
Ferhat Sevim - avatar
+ 2
@Ferhat Sevim thankyou
24th Sep 2017, 6:25 PM
yash gupta
yash gupta - avatar