KnowledgeBoat Logo
|

Computer Science

What will be the output of the following code?

A = 'Virtual Reality'
A.replace('Virtual', 'Augmented')
  1. Virtual Augmented
  2. Reality Augmented
  3. Augmented Virtual
  4. Augmented Reality

Python String Manipulation

2 Likes

Answer

Augmented Reality

Reason — The replace() method creates and returns a new string with the specified substring replaced, without altering the original string. In this case, 'Virtual' is replaced by 'Augmented', resulting in 'Augmented Reality'.

Answered By

2 Likes


Related Questions