Jun 6, 2021
1 min read
String in python is immutable object. Immutable object’s value can not be changed. In case of replacing character of a string , It create a new string after replacing the characters.
Here is what you are looking for :
For Example, replacing “H” with “Y” in “Hello World” returns “Yello World”
|
|
output:
Yello World
|
|
Output
Yello World
Yello Horld