Anti_vowel, strange error


I am getting this error : Oops, try again. Your function fails on anti_vowel("Hey look Words!"). It returns "bcdHy lk Wrds!" when it should return "Hy lk Wrds!".

I am really confused where the bcd comes from?

def anti_vowel(text):
    for i in text:
        if i not in 'aeiouAEIOU':
    return ''.join(no_vowels)


the exercise calls your function (not the whole script, just the function) multiply times. Because no_vowels declaration is outside your function, it might have leftovers from earlier calls, place the no_vowels declaration inside the function


I am not able to get rid of all vowels, my output is 'Hy lk Words!'. Suggestions welcome

def anti_vowel(text):
t = []
for i in text:
vowels = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U']
for x in t:
if x in vowels:
return "".join(t)

print anti_vowel("Hey look Words!")


do not use remove, it causes index shift and it super difficult to get it working with remove

append constants to a new list


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