Anti-vowel - working but getting error



Oops, try again. Your function fails on anti_vowel("Hey look Words!"). It returns "None" when it should return "Hy lk Wrds!".

it works as i printed the outcome to check but getting an error none the less

vowels = ["a","A","e","E","i","I","o","O","u","U"]
word   = []

def anti_vowel(text):
    for l in text:
        if l in vowels:
    fin = "".join(word)
    print fin
anti_vowel("Hey look Words!")



if printed out, returns None first. Hence the test case bounces you off despite you have the right stuff printing on the console.

I suggest you make word a local variable in the function, before the for loop and equate to a string, that way you avoid using the .join method. word = "".

That way, you then can loop for if l is not in vowels and then returns the a the word and l until all is represented.

Finally, just return the word from the for loop.


Nice one thanks for the help.


You're welcome.

Have fun coding! :keyboard: :wink:


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