title: Why doesn't text.replace("old", "new") change the text variable?
body: <p>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.</p>
  <p>here is the code i try to run.</p>
  <pre><code>#setting text as variable
  text= &quot;hi my name is john&quot;
  
  #replacing the names
  text.replace (&quot;john&quot;, &quot;peter&quot;)
  
  #printing the new string
  print (text)
  </code></pre>
  <p>for my understanding of the function replace () shouldn't it replace john with peter?
  or what is my mistake?</p>
  <p>thanks in advance</p>