I am trying to find the index of last occurrence of a particular character in a string.
eg: s = [1,2,3,4,2,4,5,4]
in the above string I need to find the index of '4' that was situated last in the string. could anyone help me out in this?
Thank you
I am trying to find the index of last occurrence of a particular character in a string.
eg: s = [1,2,3,4,2,4,5,4]
in the above string I need to find the index of '4' that was situated last in the string. could anyone help me out in this?
Thank you
Get the length which tells how many items are in your list (8) and minus one because indices start at 0 (0-7)
s = [1,2,3,4,2,4,5,4]
f = len(s) - 1
print f
print s[f]