Function returns "Hy lk Words!"


#1

Here's the error message.

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

I tried running the same code through the builder in sublime text 2 and the output was the same ("Hy lk Words!"). Here's my code as a reference:
def anti_vowel(text):
wrd=[]
for n in text:
wrd.append(n)
for x in wrd:
if x in "aeioouAEIOU" or x == "o":
wrd.remove(x)
return ''.join(map(str, wrd))


Anti-Vowel
#2

Rather than remove vowels, append only non-vowels to the list:

Eg.

def anti_vowels(text):
    no_vowels = []
    for x in text:
        if x not in "aeiouAEIOU":    # Note `not in`
            no_vowels.append(x)
    return "".join(no_vowels)
print anti_vowels("Mississippi River")