I want to find the position (or index) of the last occurrence of a certain substring in given input string str.
str
For example, suppose the input string is
Use .rfind():
>>> s = 'hello' >>> s.rfind('l') 3
Also don't use str as variable name or you'll shadow the built-in str().