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!

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

code challenge : disemvowel problem

I dont understand what is the problem . Would appreciate help :)

def disemvowel(word):
    removed_letters = ["a", "e", "i", "o", "u",",A","E","I","O","U"]
    for letter in list_word:
        if letter in removed_letters:
    return list_word

2 Answers

No need to make the vowel string a list. Use lower() to eliminate the need to include both upper and lower case.

def disemvowel(word):
    new_word = ''
    for letter in word:
        if letter.lower() not in 'aeiou':
            new_word = new_word + letter
    return new_word

You can't split a word into characters with split(). You can make a list of characters from a word by using list():

list_word = list(word)

Also, you're returning a list. The challenge says you have to return a word. So you'll have to join the characters back into a string before you return it.

return ''.join(list_word)

Mark's solution is more elegant, but you have the general idea.