I try to do a simple string replacement, but I don't know why it doesn't seem to work:
X = "hello world"
X.replace("hello", "goodbye")
I want to change the word hello
to goodbye
, thus it should change the string "hello world"
to "goodbye world"
. But X just remains "hello world"
. Why is my code not working?