Anti_vowel?


#1



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


I'm having trouble getting the code to run through the whole text string..
it says: Your function fails on anti_vowel("Hey look Words!"). It returns "H" when it should return "Hy lk Wrds!".


I'm wondering why it won't run through all n? I was going to do a while loop but when I was looking at other people's issues I could see that using a for loop was much cleaner and simpler... but mine either stops after H or stops after He, but it doesn't go all the way???

def anti_vowel(text):
    x = []
    for n in txt:
        if n not in 'aeiouAEIOU':
            x.append(n)
        return ''.join(x)


#2

The return statement is inside the loop block so returning before the text is completely iterated.


#3

oh, duh! thank you!!


#4

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