79600365

Date: 2025-04-30 13:05:25
Score: 1
Natty:
Report link

If for some reason you don't want to use `str.rfind` and are only trying to find 1 character, you can look for all indices that fit your criteria and take the maximum like so

word = "banana"
a = "a"
last_index = max(i for (i, c) in enumerate(word) if c == a)
print(last_index)
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Nevpzo