Anti_vowel problem with remaining vowels


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,"")


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


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


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