title: what is wrong with this script? the function does not replace the old email with a new one
body: <p>I tried to write a script that replaces Hotmail address with Gmail if found in the input, but there is something wrong with the function I think. There is no syntax error but the result just does not output the replaced Gmail domain but the same Hotmail one.</p>
  <pre><code>old_email = &quot;hotmail.com&quot;
  new_email = &quot;gmail.com&quot;
  email = input(&quot;Enter email: &quot;)
  
  def replace_domain(email, old_email, new_email):
      if &quot;@&quot; + old_email in email.endswith:
          index = len(old_email)
          new = email[:-index]+ &quot;@&quot; + new_email
          return new
      return email
  a = email
  print(a)
  </code></pre>