Anti_Vowel Help


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

return "Hy lk Wrds!"

def anti_vowel(text):
    string = text
    for c in text:
        if c in 'aeiouAEIOU':
            string.replace(c, "")
    return string


Hi, @oiciruam ,

A Python object of str type is immutable, meaning that it cannot be altered. Therefore, ...

string.replace(c, "")

... does not actually change the object referred to by the variable, string.

Your function needs to create and return a new string.


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