I am working on the anti_vowel practice and using the code below. I don't understand where I went wrong. I would appreciate it if you could provide me any 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!".

def anti_vowel(text):
    for letter in text:
        if letter in "aeiouAEIOU":
            text.replace(letter, "")
            return text
            return text


a function ends the moment a return keyword is reached, you might want to replace return outside the loop so the loop can replace all the vowels

i advise against the use of replace, learning to build your own algorithm is more important, but if you really want to use replace, you currently execute a replace action, but don't store the result of this replace action anywhere?


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