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

Alejandro Byrne
Alejandro Byrne
2,562 Points

What am I missing?

I think I have my code figured out, how do I make it remove all upper cases too?

disemvowel.py
def disemvowel(word):
    word = word.list()
    word.remove('a', 'e', 'i', 'o', 'u')
    return word

1 Answer

Ok, here's an error list:

:x: .list() sadly isn't a Python function on strings. However, there is a function called list() that take sin a string as am argument!

:x: You can only pass in ONE argument to remove.

:x: Even if you can pass in multiple arguments to remove to call lots of removes, it only will remove the first vowels. Keep in mind that .remove() _only removes the first existence of an element!

Here's a checklist. To fix your program, you should follow these steps :+1:

:white_check_mark: Set word equal to list(word), not word.list().

:white_check_mark: Make a loop to go through all of the elements of the list. If the element is in the list ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'] using the in keyword.

:white_check_mark: If the current element is in the vowel list, remove the items with .remove().


I hope this helps. If you need more hints, please reply. Thanks!

I hope this helps. ~Alex