Anti_vowel


#1



https://www.codecademy.com/courses/python-intermediate-en-rCQKw/1/2?curriculum_id=4f89dab3d788890003000096#

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


why the "o" in "Words" is not remove?? if I add anythings like "Hey look loo Words!" then it turn out like "Hey lk lo Words!" someone please help, thanks!


Replace this line with your code. 
def anti_vowel(text):
    input_text = []
    for x in text:
        input_text.append(x)

    for y in input_text:
        if y == "a" or y == "A" or y == "o" or y == "O" or y == "e" or y == "E" or y == "u" or y == "U" or y == "i" or y == "I":
            z = input_text.index(y)
            input_text.pop(z)
            print input_text

    string_test = ""
    for k in input_text:
        string_test = string_test + k

    return string_test

print anti_vowel("Hey look Words")


#2

Changing a list you're currently looping through is going to affect the loop, something you haven't accounted for.
Rather than trying to solve that problem, avoid it - don't loop through and change the same list


#3

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