index()
The `index()` method returns the index of the first occurrence of a specified substring within a string.
It can be used to determine whether a substring exists in a string and find its position if it does.
If the substring is not found, `index()` returns -1.
text = "Hello, world!"
index = text.index("world") # Output: 7
rfind()
Similar to `index()`, the `rfind()` method returns the index of the last occurrence of a specified substring within a string.
It can be used to find the last position of a substring within a string.
text = "Hello, world!"
last_index = text.rfind("o") # Output: 8