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 need you to make it so, inside of the function, all of the vowels ("a", "e", "i", "o", and "u") are removed from the w

the code gives me right result on my local python idle ,but i get bummer issues on tree house python interpreter

can somebody come to the rescue

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

    counter=0
    try:
        while counter < len(wordlist):
            for cnt in vowels:
                if (wordlist[counter]) in vowels:
                    del wordlist[counter]
            counter= counter+1
    except IndexError:
         pass               




    return word
disemvowel("KIMkArDasHian")

1 Answer

Steven Parker
Steven Parker
230,995 Points

Here's a few hints:

  • this code manipulates "wordlist", but returns the unchanged "word"
  • "wordlist" will need to be converted back into a string to be a suitable result
  • the capitalization of the letters that remain in the word should remain unchanged
  • you shouldn't need "try/except" for this task
  • you only need to define the function, you don't need to call it yourself