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

This code works right on my local environment. Treehouse doesn't accept it.

I asked this same question earlier and someone pointed that I was missing capital letters in the words. For example "Apple"

I thought that's the issue and closed that question. However, even after including capital letters, treehouse is not accepting it as right answer.

I checked this code with 5000 randomly generated words. And it eliminated all the vowels.

I don't understand what is wrong with it.

Please suggest.

disemvowel.py
def disemvowel(word):
    word_list = list(word)
    for letter in ["a", "e", "i", "o", "u", "A", "E", "I", "O", "U"]:
        while True:
            try:
                word_list.remove(letter)
            except ValueError:
                break
    word = "".join(word_list)
    return word
Chris Freeman
Chris Freeman
Treehouse Moderator 68,441 Points

The code passed the challenge when I tried. What error are you seeing when it doesn't pass?

It's just giving me message "Bummer: Try again"

Please check this for screenshot. https://postimg.org/image/tnwrmld3l/

2 Answers

Steven Parker
Steven Parker
231,236 Points

Your code works fine for me.

I just pasted it right into the challenge and immediately got "Congrats, you completed the challenge!"

Maybe there was something else going on during your last attempt? I'd say just try it again.

I'm submitting this code for last 2-3 weeks and have restarted the test 10 times by now to come up with the same error again and again.

Please check this link to see the screenshot of the error. It's just giving me message "Bummer: Try again"

https://postimg.org/image/tnwrmld3l/

Steven Parker
Steven Parker
231,236 Points

The code in the screenshot is different and has an error. Try cutting from the box above and pasting into the challenge like I did.

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,441 Points

In your last posted comment code, remove line #2. It's a redundant function declaration.

Wow, when I took the screenshot, I mistakenly put the extra line there. But I swear I was not putting it earlier when I was getting the error. Like when I posted this question, the system captured my code which is included here. It looks totally the same code that I submitted now. But I don't know how, when I submitted the code right now, it accepted it.

Thanks a lot for the help. I don't rationally know what happened that made the code get accepted. But anyways, thanks a lot for getting me unstuck from one place.