Anti Vowel



My code is not detecting the vowel in the word "Words".
I am getting this error:
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):
s = []
for i in text:
for i in s:
    if i == "A" or i == "E" or i == "I" or i == "O" or i == "U" or i == "a" or i == "e" or i == "i" or i == "o" or i == "u":

t = ""
for i in s:
return t


This is because of the way remove works. It doesn't take the element that is at the current index pointer, but the first one it encounters from the left side of the list. This will need a little tweak to correct that.


Then how can i remove the current item?


The simplest way is to consider that you have two iterables. The input string, and a list of vowels (as opposed to a whole if expression). Iterate the vowels, and remove each one from the input string. No need to verify, just use while.


thanks for the help. got the solution


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.