Anti_vowel problem with remaining vowels


#1



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

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

Hi guys,
I am trying to figure out why my function refuses to cooperate after replacing the first vowel.

Thank you


def anti_vowel(text):
    vowel = "aeiouAEIOU"
    for word in text:
        while word in vowel:
            return text.replace(word,"")


#2

The return should not be inside any loop.

def ___:

    return ___

We should be writing an algorithm that does not use a built-in function so we get the most practice. But... If one were to use replace() we need only to iterate over the vowels.

for letter in vowel:
    text = text.replace(letter, "")
return text

#3

Thank you for your help. I will try to solve the problem without using built in functions anyway. Cheers


#4

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