I am just learning python and wanted to create a little program which changes words in a string. But for some reason it doesn't work how i intended.
here is the code i try to run.
#setting text as variable
text= "hi my name is john"
#replacing the names
text.replace ("john", "peter")
#printing the new string
print (text)
for my understanding of the function replace () shouldn't it replace john with peter? or what is my mistake?
thanks in advance