How to insert a character in a string considering a few conditions in python
Question: Say I will ask the user to input a string. How can I add a character at the
end of every word that ends in "a", "e" or "o"?

For example, from

    
    
    f = "O, awesome people, help me if ya will"
    

I'd have

    
    
    f = "Oh, awesomeh peopleh, help meh if yah will"
    


Answer: Use `re.sub`

    
    
    re.sub(r'(?i)([aeo])\b', r'\1h', s)
    

  * `(?i)` helps to do case-insensitive match.
  * `([aeo])` captures a,e,o only if it's followed by a word boundary.

**Example:**

    
    
    >>> import re
    >>> f = "O, awesome people, help me if ya will"
    >>> re.sub(r'(?i)([aeo])\b', r'\1h', f)
    'Oh, awesomeh peopleh, help meh if yah will'
    

