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

remove

I don't understand what I am doing wrong.

disemvowel.py
def disemvowel(word):
    vowels= ("aeiou")
    wordlist = vowels
    for words in word:
        print(words.upper())
        print(words.lower())
    for letter in wordlist:
        words.remove(letter)
    return word

1 Answer

Steven Parker
Steven Parker
231,269 Points

I see a few issues:

  • after the first loop ends, "words" (plural) is out of scope (and not available inside the 2nd loop)
  • "remove" is a list function and not available on strings
  • the "remove" function only removes the first occurrence of the matched item, not all of them
  • you need to remove either case, but the code currently only check lower case
  • "word" is never modified, and is being returned unchanged