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 last
to posn
you would use range(last, posn - 1, -1)
.