In Java, I have the following for loop and I am learning Python:
for (int index = last-1; index >= posn; index--)
My question is simple and probably obvious for most of people who are familiar with Python. I would like to code that 'for' loop in Python. How can I do this?
I tried to do the following:
for index in range(last-1, posn, -1):
I think it should be range(last-1, posn + 1, -1)
. Am I right?
I am thankful to anyone especially who will explain to me how to understand the indices work in Python.