Replacing the last three characters in a string if they match a condition
<p>I am trying to take a user inputed string and, if it ends with <code>'ion'</code>, replace the last three characters of the string and add an <code>'e'</code>.</p>

<pre><code>def ion2e(s):
    if s[-3:]=='ion':
        print (s[-3:]+'e')
    else:
        print (s)
</code></pre>