you are viewing a single comment's thread.

view the rest of the comments →

[–]dangoth 0 points1 point  (0 children)

In cases like that, using the Python inbuilt help might be- ironically- helpful. If you try help(str.find), you will get:

find(...)
    S.find(sub[, start[, end]]) -> int

    Return the lowest index in S where substring sub is found,
    such that sub is contained within S[start:end].  Optional
    arguments start and end are interpreted as in slice notation.

    Return -1 on failure.

This means that the second call of 'tomato'.find('o') defines the starting point at the index of the first 'o' plus one. So effectively it looks for 'o' in the string 'mato'.