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

Dzumret Pelivani
Dzumret Pelivani
5,399 Points

Problem with "disemvowel(word)" function. What I am missing here? I get an error in code challenge.

The code does remove all the vowels in a word, why am I getting an "Bummer! Hmm, got back unexpected characters" ? Have I missed something obvious ?

disemvowel.py
def disemvowel(word):
    """Function to disemvowel words"""
    letter_list = list(word.lower())
    vowels = list('aeiou')
    for vowel in vowels:
        while True:
            try:
                letter_list.remove(vowel)
            except ValueError:
                break
    return ''.join(letter_list)

1 Answer

Steven Parker
Steven Parker
231,128 Points

Your function does a bit more than was asked.

You effectively remove the vowels, but you also convert all the remaining characters to lowercase.

To pass the challenge, you will need to remove the vowels but leave the other characters as they are.

Dzumret Pelivani
Dzumret Pelivani
5,399 Points

Dzumret Pelivani less than a minute ago

Thank you Steven for a quick response.

I was banging my head :) trying to understand whats wrong, when I misunderstod the task by itself.