1. Home
  2. Data Science
  3. Python
  4. Which method is used to find the index of the first…

Added 4 May 2024

Which method is used to find the index of the first occurrence of a substring in a string?

  1. index()
  2. find() Correct answer
  3. search()
  4. locate()

Correct answer

B. find()

13 views

MCQSEXAM

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

Shown after review. No links please.

More Python MCQs

Practise all Python MCQs

Similar MCQs