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

Savannah Logan
Savannah Logan
974 Points

My code seems to work perfect in workspace but it is still no passing the test. anyone else having this problem?

I have tried it a few different ways but keep getting the same error that a few unwanted letters keep appearing...

disemvowel.py
def disemvowel(word):
    word_list = list(word)
    for letter in word:
        if letter.lower() in 'aeiou':
            word_list.remove(letter)
    return ''.join(word)

2 Answers

Abdishakur Hassan
Abdishakur Hassan
3,585 Points

You need to reasign the original Word to the join method instead of Only returning it.

Word = ''. Join (word_list)

You could return the join as well, however you need to use it on 'world_list' and not on 'word' since you have applied the remove method to 'word_list' and not 'word'.

return ''.join(word_list)

instead of

return ''.join(word)