replace() function :# Replace a string with another string
my_string = "Hello, World!"
new_string = my_string.replace("World", "Python")
print("The new string is:", new_string)The new string is: Hello, Python!my_string`. We then use the `replace()` function to replace the substring `"World"` in `my_string` with the substring `"Python"`, and assign the result to the variable `new_string`.print()` function to print the message "The new string is:" followed by the value of `new_string`.replace()` function replaces all occurrences of the substring `"World"` in the string with the substring `"Python"`.