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

srikanth soma
srikanth soma
1,572 Points

can't convert list to string?

def disemvowel(word):
    vowels = ['a','e','i','o','u','A','E','I','O','U']
    word_list = list(word)
    for letters in word_list:
        if letters in vowels:
            word_list.remove(letters)
    return ''.join(word_list)

I asked this question bunch of times before but strangely I'm unable to understand joins at all

disemvowel.py
def disemvowel(word):
    vowels = ['a','e','i','o','u','A','E','I','O','U']
    word_list = list(word)
    for letters in word_list:
        if letters in vowels:
            word_list.remove(letters)
    return ''.join(word_list)

2 Answers

Oszkár Fehér
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Oszkár Fehér
Treehouse Project Reviewer

Hello Soma Your code looks ok and it works just a little exception, so the for() can loop trough the word without making from the word a list, a string it's already a list

for letter in word:

This will pass the test. The join method you did it well, it looks like you understand it. I hope this helps you. Happy coding

srikanth soma
srikanth soma
1,572 Points

Thanks for the help :)