8. anti-vowel - Having trouble


#1




My code is supposed to return a string that has all vowels removed from the original string. I am getting the error message, "Oops, try again. Your function fails on anti_vowel("Hey look Words!"). It returns "Hey look Words!" when it should return "Hy lk Wrds!"." Am I removing the vowels in the wrong way possibly?


def anti_vowel(text):
    empty = []
    for i in text:
        empty.append("aeiouAEIOU")
        return text
print anti_vowel("Hey look Words!")

Thank you!


#2

Hello @geckosrock,

Your code isn't working because you aren't actually checking your code for the presence of vowels. You should use something like this

if letter in vowels:
    #remove letter

Since I can't give you the code (That would be cheating!), you will have to figure out your own mechanism for removing the vowels from the text.

Hint: I would use an if statement to just append all the characters that AREN'T vowels... then use Python's .join() method... but its up to you

Cheers!


#3

Thanks! I was just thinking that it was probably checking the string for all the vowels at once and not specific ones. Thanks for the help! :slight_smile:


#4

Don't forget to give me a thumbs up, and notify this question as solved so it can be closed....


#5

Oh yeah! I've never done that before so I didn't remember.


#6

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