My code produces the exact message it's supposed to but the codecademy keeps giving me an error saying "none"


#1


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

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

the compiler says

Hy lk Wrds!
None
None

heres my code

vowels = ["a", "e", "i", "o", "u", "A", "E", "I", "O", "U"]
def anti_vowel(word):
    newword = []
    for i in word:
        if i not in vowels:
            newword.append(i)
    print ''.join(newword)
print anti_vowel('Hey look Words!')

it literally gives me the exact output I'm supposed to get (granted I have no idea why it's printing "none" twice) but still says it's wrong. I don't understand.


#2

Change print for return in line 7. Your function isn't returning anything, so when you call it in line 8, the result is None


#3

[edit] lol that's so simple.


#4

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