Find() first find the index of the first letter match value and then check it the entire substring is contained in string?

I don’t really understand find() method. At first, I thought it was kind of like the remove() method in the sense that
remove() removes the first matching item in the list, while find() returns the index of the first letter of the substring.
But, if the entire substring does not contain in the string, it will return -1.
So is my understanding correct? find() first find the index of the first letter of the substring, and then sees if
the entire substring is contained in the string. If it does, then the index of the first letter of substring is returned.
Otherwise, -1 will be returned. If the first letter of the substring does not exist in string, -1 is returned?

1 Like

Have you read the docs for the function yet? If you have not then I suggest you go look for the find function in the documentation and read what it does and what each return value is. You should be doing this for every function that you use as the documentation will be more accurate than asking in a forum or asking on stack overflow. At least in theory.