Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Python Collections (2016, retired 2019) Lists Disemvowel

what am I doing wrong

There is a SyntaxError on Line 4. What am I doing wrong? Thanks in advance

disemvowel.py
def disemvowel(word):
    word_list = list(word)
    for item in word_list:
        elif item.lower() = "a"
            del item
        elif item.lower() = "e":
            del item
        elif item.lower() = "i":
            del item
        elif item.lower() = "o":
            del item
        elif item.lower() = "u":
            del item
    return word

3 Answers

Nicholas Tan
PLUS
Nicholas Tan
Courses Plus Student 8,562 Points

change your elif item.lower() = "a" to if item.lower() = "a"

I tried it but it didn't work. Thank you.

Sydney O'Reilly
Sydney O'Reilly
3,183 Points

Your if/elif/else statement needs an "if" as the first statement. I don't think they can all be "elif"! You're also missing a piece of punctuation in that statement on line 4.

Also, at the end, you're returning your variable "word". Are you sure you're making changes to that variable they way this is written? :)

Nicholas Tan
PLUS
Nicholas Tan
Courses Plus Student 8,562 Points

try this to be very clear

def disemvowel(word):
    word_list = list(word)
    for item in word_list:
        if item.lower() = "a":
            del item
        elif item.lower() = "e":
            del item
        elif item.lower() = "i":
            del item
        elif item.lower() = "o":
            del item
        elif item.lower() = "u":
            del item
    return word

Thank you. I tried this but their was still a syntax error on line 4. Happy new year.