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

Vidhya Sagar
Vidhya Sagar
1,568 Points

Removing vowels .

Code works fine in Workspaces, If i am doing something wrong please point it out .

disemvowel.py
def disemvowel(word):
    vowel_list=list("aeiou")
    word=list(word.lower())
    for vowel in vowel_list:
        while True:
            try:
                word.remove(vowel)
            except:
                break
    output="".join(word)  

    return output 

2 Answers

The challenge expects you to remove both lowercase and uppercase vowels.

:point_right: Your program seems to only remove lowercase vowels.

In other words, good work making your program! :+1:

I hope this helps. :grin:

~Alex

Vidhya Sagar
Vidhya Sagar
1,568 Points

Yeah, but i made all the letters in the word lower case so all the vowels in the word will also be lowercase right ? Check out this line

word=list(word.lower())

No, the challenge doesn't want you to return a lowercase string!

For example, If I input "PineappleApple", the code challenge wants the output to be "Pnpplppl", not "pnpplppl"!

You shouldn't lowercase the entire string at the beginning. It might affect the output to be all lowercase!

To fix this, I would remove the .lower() part from word = list(word.lower()) and add all the uppercase vowels to the vowel_list.

No problem :)