Use the replace method in a string object.

Replace method gets three params: two mandatory (the first string what we want to replace and the second string with which we replace) and one optional (count of replacement).

my_string = "Hello world!"
print(my_string.replace("Hello", "Goodbye"))

my_string = "banana, banana, orange"
print(my_string.replace("banana", "apple"))

print(my_string.replace("banana", "apple", 1))