Anti_vowel stops at vowels instead of removing them


#1



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


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


The vowels are stopping the function for some reason.


def anti_vowel(text):
    for letter in text:
        if letter == 'a' or letter == 'e' or letter == 'i' or letter == 'o' or letter == 'u':
            return ''
        else:
            return letter


#2

a function ends the moment a return keyword is reached

so your function ends in the first iteration of the loop, you will need to rethink your approach

maybe you can make a list/string to append the consonants to? This will give you an anti vowel string


#3

Thanks, I made a list and used .join on it. Now it works just fine! :grinning:


#4