How can you produce the following list with range() in Python?
[9, 8, 7, 6, 5, 4, 3, 2, 1, 0]
range(9,-1,-1)
[9, 8, 7, 6, 5, 4, 3, 2, 1, 0]
Is the correct form. If you use
reversed(range(10))
you wont get a 0 case. For instance, say your 10 isn't a magic number and a variable you're using to lookup start from reverse. If your n case is 0, reversed(range(0)) will not execute which is wrong if you by chance have a single object in the zero index.