Anti_vowel excersize error


#1

My code looks like this:

def anti_vowel(text):
    final_str=''
    for char in text:
        if char in 'aeiouAEIOU':
            final_str=final_str.replace(char,'')
        else: 
            final_str=final_str
    return final_str
print('a')

The console says:

a
None

and this popup comes:


#2

Do you agree with that your function has that behaviour?
If not, verify.

If yes, compare what you want it to do, with what it actually does. Print statements are useful for this.


#3

@ionatan
I don't agree that the function has that behavior.


#4

Then verify. The error message says how it tested your function.


#5

@ionatan
You mean adding this?:

anti_vowel("Hey look Words!")

#6

I think you're almost there.

The main thing to change is what happens inside your ELSE statement. If CHAR is not a vowel you still need to add it to FINAL_STR so that you end up with FINAL_STR returning TEXT without the vowels.

Remember also to call the function correctly, which is this case is PRINT ANTI_VOWEL("STRING_OF_YOUR_CHOICE"). Simply stating PRINT("A") will result in printing "A" which is what you're getting and does not call on the function at all.

Hope that helps!


#7

this is what i did put 1 tab before: return "".join([p for p in text if p not in "aeiouAEIOU"])

def anti_vowel(text):
return "".join([p for p in text if p not in "aeiouAEIOU"])

print anti_vowel("the quick brown fox jumps over a lazy dog")


#8

@angusjamesallen

IT WORKED!