Anti_Vowel


#1



Help!! I don't know what's wrong!

Oops, try again. Your code looks a bit off--it threw a "'str' object has no attribute 'remove'" error. Check the Hint if you need help!


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

def anti_vowel(text):
    for vowels in text:
        vowels.remove(text)


#2

why are u removing a string of text from your list of vowels?

you probably want to loop thru each char.

for char in text:

check if it is vowel (against ur vowels list).

`


#3

Use a different variable name inside the function, else it shadows the global one.

    for char in text:

We cannot mutate an object that we are iterating by value. But we can build a new object from the accepted values.

    result = []
    for char in text:
        if char not in vowels:
            result.append(char)
    return ''.join(result)