SyntaxFix
Write A Post
Hire A Developer
Questions
To use negative indices: start at -1 and step back by -1 at each iteration.
>>> a = ["foo", "bar", "baz"] >>> for i in range(-1, -1*(len(a)+1), -1): ... print i, a[i] ... -1 baz -2 bar -3 foo