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

Douglas Brunson
PLUS
Douglas Brunson
Courses Plus Student 2,458 Points

Problem with code

Not sure why this doesn't work. Perhaps too long?

disemvowel.py
def disemvowel(word):
    word_list = list(word)
    while 'a' in word_list or 'A' in word_list or 'e' in word_list or 'E' in word_list or 'i' in word_list or 'I' in word_list or 'o' in word_list or 'O' in word_list or 'u' in word_list or 'U' in word_list:
        try:
            word_list.remove('a')
        except ValueError:
            pass
        try:
            word_list.remove('A')
        except ValueError:
            pass
        try:
            word_list.remove('e')
        except ValueError:
            pass
        try:
            word_list.remove('E')
        except ValueError:
            pass
        try:
            word_list.remove('i')
        except ValueError:
            pass
        try:
            word_list.remove('I')
        except ValueError:
            pass
        try:
            word_list.remove('o')
        except ValueError:
            pass
        try:
            word_list.remove('O')
        except ValueError:
            pass
        try:
            word_list.remove('u')
        except ValueError:
            pass
        try:
            word_list.remove('U')
        except ValueError:
            pass
    word = []
    for item in word_list:
        word = word + item
    return word