Consecutive letters

Save all these functions in file consecutive.py

  1. Write function consecutive_vowels() that, given a text (str), returns the number of (overlapping) occurrences (int) of 2 consecutive vowels in the text. Examples:

    >>> consecutive_vowels ('I was washed by an unfairly cloudburst')
    2
    >>> consecutive_vowels ('She was in the room too early in the afternoon')
    4
    >>> consecutive_vowels ('It is a goog thing it was raining when I left home otherwise I would not have brought my umbrella')
    4
    >>> consecutive_vowels ('The rain continued to pour down and all the people outside waited patienly for it to stop')
    7
    

    Note

    More tests are provided in file test-consecutive_vowels.txt

  2. Write function consecutive_consonants() that, given a text (str), returns the number of (overlapping) occurrences (int) of 3 consecutive consonants in the text. Examples:

    >>> consecutive_consonants ('The First World War lasted from 1914 to 1918')
    2
    >>> consecutive_consonants ('Pozdravlyayu s prazdnikom, Vsego nailuchshego!')
    5
    >>> consecutive_consonants ('abcdevxyz')
    3
    >>> consecutive_consonants ('It was a softly lighted mirror in the checkroom. I went there from the restaurant straight through a large corridor')
    7
    

    Note

    More tests are provided in file test-consecutive_consonants.txt

    Solution

    A solution of these functions is provided in the consecutive.py