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

How to remove vowels from a word

I am confused as to how to remove the vowels as efficiently as possible without doing each one individually.

disemvowel.py
def disemvowel(word):
    word.remove("a","e","i","o","u")
    word.remove("A", "E", "I", "O", "U")
    return word

1 Answer

Rogier Nitschelm
seal-mask
.a{fill-rule:evenodd;}techdegree
Rogier Nitschelm
iOS Development Techdegree Student 5,461 Points

I don't know any python, but the first step I would personally take is turn word into lowercase. So you only have to check for "aeiou", rather than both "aeiou" and "AEIOU".