What does `’python’.replace(‘p’, ‘P’)` return?

Python Developer Easy

Python Developer — Easy

What does `’python’.replace(‘p’, ‘P’)` return?

Key points

  • The `replace()` method changes specific characters in a string.
  • The correct answer, 'Python', reflects the replacement of 'p' with 'P'.
  • Options B and C are incorrect because they do not reflect the correct replacement.
  • Option D is incorrect because the `replace()` method does make a change to the string.

Ready to go further?

Related questions