Generation

generate functionSun, 20 Nov 2022

Write a program using re module that loops through the lines of a file or standard input (where each line contains a single word) and prints all words containing two adjacent vowels

def two_adjacent_vowels(word): vowels = re.findall(r'[aeiou]', word) if len(vowels) < 2: return False for vowel in range(len(vowels)-1): if vowels[vowel+1] == vowels[vowel]: return True return False word = 'aaa' two_adjacent_vowels(word)

Want to kickstart your project?Use the new AI Studio to create your code