Anti Vowel


Hey, so I'm not sure why my != operator isn't preventing vowels from being appended to my no_vowel list. My for statement iterates through my argument, but the != doesn't seem to do anything. Does this have to do with comparing integers to a string?

Replace this line with your code. 
def anti_vowel(text):
    no_vowel = []
    for i in range(len(text)):
        if i != "aeiouAEIOU":
    return "".join(no_vowel)
print anti_vowel("Cat!")



for i in range(len(text)):

Why use range()? this will give us numbers, which we can use as indexes, but this only complicate matters. Just get rid of range and len

now that i actually contains values from our list, a single letter can't equal a whole string of vowels.

we can use in to determine if the letter is in the vowel string. then we can use not to ensure the letters are not in vowel string


Hey, thanks! I think the problem stemmed from me making my no_vowel variable = a list and not a string. Lists cannot be appended with a string, which is why i used the range(len) function to split up my argument into integers. And everything went off the rails from there lol.


you can perfectly fine append strings to lists, its no problem:

aList = []

If you need more help, post an updated version of your code


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