8/15 help


#1

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

my code is:

def anti_vowel(text):
text = list(str(text))
vowal = "aeiouAEIOU"
for letter in text:
if letter in vowal:
text.remove(letter)
return ''.join(text)


#2

try this

def anti_vowel(text):
    # text= list(str(text)) got rid of this line
    # here we can covert all characters to lower case and check
    # against our vowal
    vowal = "aeiou"
    final_text = ''
    
    #go through the input text
    for letter in text:
        
        #convert the current letter to lowercase
        #check it against vowal
        #if it does not appear then add it to final_text
        if letter.lower() not in vowal:
            final_text+=letter
            
    #return final text
    return final_text

print( anti_vowel("LAt me go"))
print anti_vowel("Hey look Words!")

its a good idea not to be removing items from the list you are iterating as it can mess up the iterator


#3

thanks rydan now i understand!! Really appreciate your answer !