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

Matt Wolf
Matt Wolf
2,225 Points

I'm not sure why Treehouse is saying this isn't working. I ran it on my machine using python and the function works...

It works in normal python?

disemvowel.py
def disemvowel(word):
    word = word.lower()
    wordlist = list(word)
    vowels = ['a', 'e', 'i', 'o', 'u']
    for check in vowels:
        not_end = True
        while not_end:
            try:
                wordlist.remove(check)
            except ValueError:
                pass
                not_end = False
    word = "".join(wordlist)
    return word

2 Answers

Stuart Wright
Stuart Wright
41,119 Points

When your code seems to be working offline but not passing the challenge, it's usually best to re-read the challenge and make sure you're doing exactly what it asks you to do.

Notice that the challenge doesn't ask you to convert the entire string to lowercase, so your function isn't doing what the challenge is asking.

Matt Wolf
Matt Wolf
2,225 Points

Thanks - I tweaked it a bit and got it to work