Oops, try again. Your function fails on anti_vowel("Yab Gab to Trab Yab Yab Aeiouz"). It returns "Yb Gb t Trb Yb Yb Az" when it should return "Yb Gb t Trb Yb Yb z".

Replace all vowels for blanks

def anti_vowel(text):
    vowels = ('a', 'e', 'i', 'o', 'u')
    for x in text.lower():
        if x in vowels:
            text = text.replace(x, "")        
    return text


for some odd reason this fixed it:

def anti_vowel(text):
    for x in text:
        if x in "aeiouAEIOU":
            text = text.replace(x, "")        
    return text


Lists are enclosed in square brackets.

vowels = ('a', 'e', 'i', 'o', 'u')

should be

vowels = ['a', 'e', 'i', 'o', 'u']


This error doesn't make much sense to me. Everything is caught except the lower case e even though it is in the check


I just ran into the same issue. The issue is in your if loop. new_word is being replaced with text every time there is a vowel. This means only one vowel will be removed.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.