I'm learning Python on codeacademy and I'm stuck on a program:
Define a function called anti_vowel that takes one string, text, as input and returns the text with all of the vowels removed.
For example:anti_vowel("Hey You!")
should return"Hy Y!"
.
Don't count Y as a vowel.
Make sure to remove lowercase and uppercase vowels.
I created the program and I don't see any way that it's wrong but I get this error code:
Oops, try again. Your function fails on
anti_vowel("Hey look Words!")
. It returns"Hy lk Words!"
when it should return"Hy lk Wrds!"
.*
Can anyone tell me what I did wrong? Here's the code:
def anti_vowel(text):
newText = ""
tList = []
for char in text:
tList.append(char)
for item in tList:
if item in "aeiouAEIOU":
tList.remove(item)
for thing in tList:
newText += thing
return newText