In Java, I have the following for loop and I am learning Python:
for (int index = last-1; index >= posn; index--)
for index in range(last-1, posn, -1):
range(last-1, posn + 1, -1)
The range function in python has the syntax:
range(start, end, step)
It has the same syntax as python lists where the start is inclusive but the end is exclusive.
So if you want to count from 5 to 1, you would use
range(5,0,-1) and if you wanted to count from
posn you would use
range(last, posn - 1, -1).