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

Disemvowel Excercise

Not getting the right answer. Can anyone please help?

disemvowel.py
def disemvowel(word):
    vowels = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U']

    word_list = list(word)

    for letter in word:
        for vowel in vowels:
            try:
                word.remove(vowel)
            except ValueError:
                continue

    word = "".join(word_list)
    return word

2 Answers

Could be the letter in word loop. As you are removing a vowel in the word, that loop is no longer correct?

Puffy wuff
Puffy wuff
9,573 Points

Hi Ali Looks like you are trying to use .remove() on a string in line 9. Try changing word to word_list. Hope this helps - I was stuck on this one for ages! :)