Anti_vowel works in Spyder but not in Codeacademy


Here's my code:

def anti_vowel(text):
    for i in text:
        if i.lower() not in ["a","e","i","o","u"]:
            anti= anti + i

This works perfectly afaik. I am using Spyder with Python 3.6.0 |Anaconda 4.3.1 (x86_64)
and when I input
anti_vowel("Hey look Words!")

I get
Hy lk Wrds!

In Codeacademy get this error message instead:
Oops, try again. Your function fails on anti_vowel("Hey look Words!"). It returns "None" when it should return "Hy lk Wrds!".

Why does the exact same code work in Spyder but not in Codeacademy? Or am I missing something entirely?


try using return rather than print. I find that's a common issue with these exercises.


This worked just fine thank you!
I'll make sure to use return in functions from now on, even if the output is a string.


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