1. Home
  2. Data Science
  3. Python
  4. What is the output of print('Python'.replace('P', 'J')) in…

Added 25 Nov 2026

What is the output of print('Python'.replace('P', 'J')) in Python?

print('Python'.replace('P', 'J'))
  1. Python
  2. Jython is
  3. Jython Correct answer
  4. Error

Correct answer

C. Jython

5 views

MCQSEXAM

Explanation

replace() returns a new string with occurrences replaced.

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