Python - find the last occurrence of an item in a list with rindex()


Python tip:

You can use .rindex() to find the highest index in a string where a substring is found.

👇

print("2021 was awesome. 2022 is going to be even more awesome.".rindex("awesome"))
# => 48