So, folks. I am new to python and wanted to know the following:
Do you have any way of knowing what the negative index of an item in a list is?
For example, I have the following code:
lista = ['a', 'b', 'c', 'd', 'e', 'f', 'g']
lista.index('a')
0
lista.index('g')
6
I would like to know if there is a method that returns the index backwards, like this:
lista.index('g')
-1
lista.index('a')
-7
I could not find anything like it.