Which method is used to find the index of the first occurrence of a substring in a string?
-
A
index()
-
B
find()
Correct answer
-
C
search()
-
D
locate()
13 views
Explanation
The find() method returns the index of the first occurrence of a substring in a string.
Doubts & discussion
Not sure why the answer is B? Ask here and get an explanation.
Ask a doubt about this MCQ