Anti_vowel


#1



Hello, I don't, know why my code does not work. Please help me.

https://www.codecademy.com/courses/python-intermediate-en-rCQKw/1/2?curriculum_id=4f89dab3d788890003000096#


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


def anti_vowel(text):
    text_list = list(text)
    vowels = "aeiouAEIOU"
    vowels_list = list(vowels)
    for x in text_list:
        if x in vowels_list:
            text_list.remove(x)
    return "".join(text_list)


#2

because you get to deal with index shift. (the moment the first o of look gets removed, the second o shifts index, and the loops continues to the next letter (which thanks to this shift is now k))

It is much easier to append constants to a new list


#3

alright, thanks. It worked.