Anti_vowels


#1



I don't know why my code doesn't work. What's wrong with it?


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


def anti_vowel(text):
    vowels = ["a","A", "i","I","e","E","o","O","u","U"]
    verander = text
    for x in vowels:
        if text == x:
            verander.remove(x)
            return verander
        else:
            return verander


#2

You can't change strings, but you can create new ones
You're currently returning the very same object as is given as an argument to your function.
Your loop also only performs one iteration, because it exits the function on each iteration - it's therefore not a loop at all


#3

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