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

james mchugh
james mchugh
6,234 Points

no idea

I don't understand why it asks us to do things it hasn't shown us how to do. It showed how to remove items from a list then expects us to know how to pull specific letter from these items. I feel like it teaches us step 3 and expects us to know step 1 and 2 without teaching it.

disemvowel.py
def disemvowel(word):
    remove.upper = ("a", "e", "i", "O", "u")
try:
    word.upper.remove(word)
    return word

1 Answer

Tyler B
Tyler B
5,787 Points

Hey James I know they do that a lot and it can be a real curve ball but I believe it's done on purpose as honestly that is half of what coding is about (finding answers you don't have). Whether that's sharpening your google-fu or writing clear questions on community boards like this. These are skills, believe it or not, you'll find incredibly helpful some day. I have a solution for you to check out, keep in mind this is in no way the only or "best" way to do it.

def disemvowel(word):
    hitList = ("a","e","i","o","u")
    wordList = list(word)
    for char in hitList:
        try:
            wordList.remove(char)
        except:
            pass
        try:
            wordList.remove(char.upper)
        except:
            pass
    return ''.join(wordList)
james mchugh
james mchugh
6,234 Points

Tyler, Thanks a lot for your encouragement. Your explanation really makes sense. We are constantly in situations where there are no answers. That's why I have to learn to use the boards, forums, and search engines. You've been very helpful!