I just started to learn Python in codacademy. I was trying to do anti-vowel function, but found the following problem with 'u'.
def anti_vowel(text):
a = []
for i in text:
a.append(i)
for item in a:
if item in "aeiouAEIOU":
a.remove(item)
print ''.join(a)
print anti_vowel("Hey You!")
print anti_vowel("Hey look Words!")
print anti_vowel("aeiouAEIOU")
It printed
"Hy Yu!"
"Hy lk Words!"
"eoAIU"
Instead of
"Hy Y!"
"Hy lk Wrds!"
""
Somehow, some vowels was not removed es expected.
I found many alternatives for the function. However, please help me identify the mistake of the current code.