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

please help me on this

its not passing

disemvowel.py
def disemvowel(word):
    vowels = ['a', 'e', 'i', 'o', 'u']
    word = letters[]
        try:
            letters[] - ([vowels].upper() + [vowels])
        else:
            pass
    ', '.join(letters) = word
    return word

1 Answer

Nthulane Makgato
PLUS
Nthulane Makgato
Courses Plus Student 19,602 Points

Hi Terence,

I'm not completely sure what's going on in your code but its a decent first stab because you have identified the vowels in list and you're trying to compare the word to the list.

Here are some guiding steps:

  1. Your vowels, include lowercase vowels and upper case ones.
vowels = list('aeiouAEIOU')
  1. Turn the "word" into a list with list(word). This is where you will remove your letters from.
word_list = list(word)
  1. Loop through all the letters in the word with a for loop.

    for letter in word:
    
  2. In each loop, check that each letter is in vowels. If its in vowels, then remove it.

    if letter in vowels:
                word_list.remove(letter)
    

At the end, join the remaining letters in the word_list and return them.

I hope this helps.