Last active
November 2, 2023 11:07
-
-
Save Codehunter-py/8f7690555c73858e1aaa760c8a5b3ab8 to your computer and use it in GitHub Desktop.
The multi_vowel_words function returns all words with 3 or more consecutive vowels (a, e, i, o, u).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
def multi_vowel_words(text): | |
pattern = r"(\w+[a,e,i,o,u]{3,}\w+)" | |
result = re.findall(pattern, text) | |
return result | |
print(multi_vowel_words("Life is beautiful")) | |
# ['beautiful'] | |
print(multi_vowel_words("Obviously, the queen is courageous and gracious.")) | |
# ['Obviously', 'queen', 'courageous', 'gracious'] | |
print(multi_vowel_words("The rambunctious children had to sit quietly and await their delicious dinner.")) | |
# ['rambunctious', 'quietly', 'delicious'] | |
print(multi_vowel_words("The order of a data queue is First In First Out (FIFO)")) | |
# ['queue'] | |
print(multi_vowel_words("Hello world!")) | |
# [] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
no need to insert , commas in [a,e,i,o,u] you may write it without commas