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

I'm not getting to the logic

Please somebody help me. This is my 3rd trial at this task. Can somebody please show me how you solve it? I tried a lot but it didn't work...

Thank you very much

disemvowel.py
def disemvowel(word):
    word_list = word.list()
    vowels = ["a", "e", "i", "o", "u"]

    letter = #iterating letters in word list

    for letter in vowels:
        word_list.remove(vowels)

    word = word_list.str()

    return word

2 Answers

for letter in vowels
    word_list.remove(vowels)

is not the correct use of for in. for in is a way to go through individual items in a group of items.

You want to reference letter in there not vowels. letter is the item in the group, vowels is the entire group at the same time.

Steven Parker
Steven Parker
231,007 Points

Logically, it looks like you have the right idea.

But you have a few syntax issues:

  • strings don't have a list method, but you can create a list using "list(string)"
  • remove only takes one item away, but the word may have more than one of the same vowel
  • you need to remove both upper-case and lower-case vowels
  • part of your comment is on the wrong side of the "#" symbol
  • lists don't have a str method, but you can create a string using "separator_string.join(list)"