Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generate decreasing list of integers using python range

This is a simple question. I have

range(1, 11)[::-1]

which gives me

[10, 9, 8, 7, 6, 5, 4, 3, 2, 1]

Is there a 'cleaner' way to generate the above list? With a single function perhaps?

like image 303
AsheKetchum Avatar asked Apr 05 '17 20:04

AsheKetchum


Video Answer


1 Answers

You can use that range(10, 0, -1)

like image 80
Moi Syme Avatar answered Sep 20 '22 16:09

Moi Syme