8. anti vowel - ugly code works but not accepted


#1

So my code below is far from elegant but it seems to perform the intended task (takes a string and returns it without vowels). Any ideas as to why the course is not letting me proceed? Also is there an easier way for me to do the if statement?

thanks,

def anti_vowel(text):
    tlist = []
    for char in text:
        tlist.append(char) 

    for c in tlist:
        if c == "A" or c == "a" or c == "E" or c == "e" or c == "I" or c == "i" or \
        c == "O" or c == "o" or c == "U" or c == "u":
            tlist.remove(c)
    print "".join(tlist)
    return "".join(tlist)

anti_vowel("Hey look Words!")

#2
def anti_vowel(text):
    p = []
    for c in text:
        if c not in "ueoaiUEOAI":
            p.append(c)
    return "".join(p)

much more elegant :smiley: