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

Gabriel Catani
Gabriel Catani
3,897 Points

My script is not passing in the challenge, but it wors on python IDE

def disemvowel(word):
    vowels = ['a', 'e', 'i', 'o', 'u']
    word = word.lower()
    word = list(word)
    letters_to_remove = []

    for i in word:
        if i in vowels:
            letters_to_remove.append(i)

    for i in letters_to_remove:
        if i in word:
            word.remove(i)
    return word  
disemvowel.py
def disemvowel(word):
    vowels = ['a', 'e', 'i', 'o', 'u']
    word = word.lower()
    word = list(word)
    letters_to_remove = []

    for i in word:
        if i in vowels:
            letters_to_remove.append(i)

    for i in letters_to_remove:
        if i in word:
            word.remove(i)
    return word        
Steven Parker
Steven Parker
231,269 Points

:warning: Be careful about testing a challenge in an external REPL or IDE.
If you have misunderstood the challenge, it's also very likely that you will misinterpret the results.

2 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! You're almost there. But there are a couple of things going on which is making it not return the value expected. The value returned should be a string, but your code is returning a list. This is a great time to use the join method.

Also, you are altering the original capitalization of the word. If I were to send in the word "Treehouse", I would expect to get back "Trhs", but instead I'm getting back this: ['t', 'r', 'h', 's'] .

I think you can get it with these hints, but let me know if you're still stuck! :sparkles:

Gabriel Catani
Gabriel Catani
3,897 Points

Jennifer Thank you! I totally missed the return value format! I wasn't seeing any vowels in the returned value, but it still was a list. Thank you very much for your time helping me!

And Steven thank you also for the heads up! I'll try to stick with workspaces and code challenges screens for the exercises.

I heard the community in treehouse was great, but now i can attest to that!

Let's get back to Python :)