s.find("z") – What does it do?
The .find() method in Python is used to search for a substring in a string.
It returns:
-
The index of the first occurrence of the substring if found.
-1 if the substring is not found.
In this case:
-
The string "python" does not contain the letter "z".
-
So, .find("z") returns **-1**.
✅ Final Output:
Summary:
.find("z") didn’t find 'z' in 'python'.
-
It returned -1 to indicate "not found."


0 Comments:
Post a Comment