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

Sanjay Noronha
Sanjay Noronha
7,296 Points

My code works but am still getting an error:

I tested this out in my terminal, please.

disemvowel.py
def disemvowel(word):
    #loop through the vowels
    for vowel in "AEIOU":
        # while the vowel  exists in the word
        while vowel in word.upper():
            # remove vowel from word
            word = word.upper().replace(vowel,"")
    return word

2 Answers

Christopher Shaw
seal-mask
PLUS
.a{fill-rule:evenodd;}techdegree seal-36
Christopher Shaw
Python Web Development Techdegree Graduate 58,248 Points

While you are removing the vowels, you are also canging the returned word to uppercase. This is why it is failing. Look for both upper and lowercase vowels, but do not change the case of the letters that are returned.

Sanjay Noronha
Sanjay Noronha
7,296 Points

Thanks a lot Christopher. You are absolutely right. All good now.