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?
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?
I don't know if it's cleaner but you could also use:
reversed(range(1, 11))