1. Home
  2. Data Science
  3. Python
  4. What is the output of print('Python'.startswith('Py')) in…

Added 25 Nov 2026

What is the output of print('Python'.startswith('Py')) in Python?

print('Python'.startswith('Py'))
  1. False
  2. None
  3. True Correct answer
  4. Error

Correct answer

C. True

5 views

MCQSEXAM

Explanation

startswith() checks whether the string begins with the given prefix.

Reference

Asked in: Python Interview Strings

https://docs.python.org/3/library/stdtypes.html#string-methods

Preparing for an exam?

Doubts & discussion

Not sure why the answer is C? 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