Bug in anti_vowel?


It works fine in the terminal, but I got this error massege:
Oops, try again. Your function fails on anti_vowel("Hey look Words!"). It returns "Hy lk Wrds!bcdHy lk Wrds!" when it should return "Hy lk Wrds!".

Is it a bug?

vowel = "aeiouAEIOU"
text = "Hey look Words!"
anti_vowel_list = []

def anti_vowel(text):
    for letter in text:       
        if letter not in vowel:
    return "".join(anti_vowel_list)        


Yes, it's a bug in your code


What's wrong with it? I checked it in IDLE, also in PowerShell and it returns the right answer.


You need to declare the list anti_vowel_list = [] inside the function. Take care of the indentation!


Thank you very much!


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