Weirdest ever... What's wrong w/ my anti_vowel()?


#1



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


Works flawlessly but there's an error msg:

e.g. Output:
Type a word: UIOys
ys
None

Error:
Your function fails on anti_vowel("Hey look Words!"). It returns "Hey look Words!ys" when it should return "Hy lk Wrds!".


word = raw_input("Type a word: ")
text = ""
def anti_vowel(text):    
    vowel = "aeiouAEIOU"
    for i in word:
        if i not in vowel:
            text += i
    return text
    
print anti_vowel(text)


#2

And after I shuffled the lines a bit:

word = raw_input("Type a word: ")

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

It gave me this (seems more reasonable but still off):

Type a word: asdf
sdf
None

Error: Your function fails on anti_vowel("Hey look Words!"). It returns "sdf" when it should return "Hy lk Wrds!".


#3

Look at which data it uses and consider which data it should use.


#4

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