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

Hans van den Broek
Hans van den Broek
1,243 Points

at recheck it keeps saying "got back letters i wasn't expecting", but in my tests it seems to do it just fine.

is there a mistake in the letter.lower part?

def disemvowel(word):
    vowels = list("aeiou") 
    new_word= []
    for letter in word: 
        if letter.lower() not in vowels :
    return new_word

1 Answer

james south
.a{fill-rule:evenodd;}techdegree seal-36
james south
Front End Web Development Techdegree Graduate 33,271 Points

you are returning a list, they want a string. use the join method to join the list elements into a string. delimiter.join(collection of elements to be joined). the delimiter can be the empty string, '' (two single quotes).

james south - I agree with your answer, but I'm going to add an alternative since this challenge is a bit picky anyway. Unless you do it in perfect fashion, it doesn't seem to like building a list and then using join(). Most of the issues I've come across for this challenge are from different versions of doing just that, even if in an interpreter it works perfectly. The easy way to pass the challenge would be to treat new_word as an empty string, rather than a list, and then to += letter into the string if it's meant to stay behind.

Kenneth Love
Kenneth Love
Treehouse Guest Teacher

Mike Wagner there's absolutely no issue to using list and str.join to solve this challenge. The issues you're seeing are with the logic being used, not the built-in Python functionality.

Kenneth Love - I wasn't implying there was anything wrong with Python's functionality, just that the challenge doesn't appear to like a split/join solution that appears to be correct. I haven't actually seen one that worked and almost all the issues I've come across for this challenge are related to using split/join on lists to accomplish the task. A great many of them even seem to achieve what the task asks for. I would be curious to see a functional solution that employed a split/join action, as I haven't been able to figure this challenge out using one.