String construction

Save all functions into the same file named construction.py.

  1. Write the function vowels_elimination() that takes a string with a text, and returns another string with the same characters and in the same order than in the first string but without any vowel. Examples:

    >>> t = 'The First World War lasted from 1914 to 1918'
    >>> vowels_elimination(t)
    'Th Frst Wrld Wr lstd frm 1914 t 1918'
    >>> t = 'ATENEA is the UPC Virtual Campus'
    >>> vowels_elimination(t)
    'TN s th PC Vrtl Cmps'
    >>> t = 'Three can keep a secret, if two of them are dead. Benjamin Franklin'
    >>> vowels_elimination(t)
    'Thr cn kp  scrt, f tw f thm r dd. Bnjmn Frnkln'
    

    Note

    More tests are provided in the construction1.txt file.

  2. We want to mark a text in such a way that, following all punctuation marks, the name of each of them between parentheses is added. We will only consider the 4 following punctuation marks: period (.), comma (,), colon (:) and semicolon (;).

    Write the function mark_text() that takes a string with a text, and returns another string with the same text marked in the way described.

    >>> t = 'Eat food, not too much. Mostly vegetables.'
    >>> mark_text(t)
    'Eat food,(comma) not too much.(dot) Mostly vegetables.(dot)'
    >>> t = 'I like fruit: oranges, apples, cherries, and so on.'
    >>> mark_text(t)
    'I like fruit:(colon) oranges,(comma) apples,(comma) cherries,(comma) and so on.(dot)'
    >>> t = "I ordered a cheeseburger for lunch; life's too short for counting calories"
    >>> mark_text(t)
    "I ordered a cheeseburger for lunch;(semicolon) life's too short for counting calories"
    

    Note

    More tests are provided in the construction2.txt file.

Solutions

A solution of these functions is provided in the construction.py file.