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.py query

Hello,

I'm struggling to pass this particular challenge. The code seems to work in the Workspace OK.

I noticed this solution is similar to a number of other queries in the forum, however, I couldn't understand how some of these solutions tested for uppercase/lowercase while returning the string correctly capitalised. What is the best way to test for both uppercase and lowercase while still returning the string correctly capitalised (is this necessary for this example?)

Thanks in advance and happy coding

disemvowel.py
def disemvowel(word):
    vowels = 'aeiouAEIOU'
    for letter in word:
        if letter in vowels:
            word = word.replace(letter,'_')
        else:
            pass

    return(word)

Never mind, reread the thread started by Spencer Hill and it makes sense now.