Bug in anti_vowel?


#1




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:
            anti_vowel_list.append(letter)
    return "".join(anti_vowel_list)        
                    
print(anti_vowel(text))


#2

Yes, it's a bug in your code


#3

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


#4

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


#5

Thank you very much!


#6

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