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

Ian Cole
Ian Cole
454 Points

Disemvowel Confusion

I'm completely lost at this point, I checked the one other question and I guess I just didn't understand what they were saying. Any help?

disemvowel.py
def disemvowel(word):
    bad_letters = ["A", "E", "I", "O", "U"]
    word_list = list(word)
    for item in word_list:
        if item in bad_letters:
            word_list.remove(item)

    return word

2 Answers

Steven Parker
Steven Parker
229,921 Points

You're pretty close, here's a few hints:

  • the code modifies "word_list" but then returns "word" — which has not changed
  • altering an iterator while it is controlling a loop can cause items to be skipped over
  • the instructions say to "be sure to look for both uppercase and lowercase vowels!"