Anti_vowel what is wrong?


#1

Hi. this is my code :
def anti_vowel(text):

def anti_vowel(text):
    b =""
    for i in text:
        if i not in "aeiouAEIOU":
            return i + b

and this is the error I get:

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

so why does it only return "H"?


#2

because return causes the function to return something (hand you something back) causing the function to end, try adding i to b, and then after the for loop return b

here is a little hint to help you:

a = "hello"
b = "world"
c = a + " " + b
print c # prints hello world

on how to add to a string, you can of course update variable (like b)


#3

thank you alot :slight_smile:


#4