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

Raduica Sebastian
PLUS
Raduica Sebastian
Courses Plus Student 1,356 Points

Removing vowels from a word

It dosen't work this way.. and i can't thing for another solution

disemvowel.py
def disemvowel(word):
    word=word.lower()
    word=list(word)
    for letter in word:
        if letter == "a":
            word.remove("a")   
        elif letter == "e":
            word.remove("e")
        elif letter == "i":
            word.remove("i")
        elif letter == "o":
            word.remove("o")
        elif letter == "u":
            word.remove("u")
return word

1 Answer

AJ Salmon
AJ Salmon
5,675 Points

Hi there! This challenge asks you to remove all of the vowels from a word, and then return that word as a string, so you'll have to use .join() at the end. Also, if the original word has uppercase consonants in it, you'll need to keep those as uppercase (so disemvowel(Treehouse) would return Trhs. Your code would return trhs, which wouldn't pass the challenge, so don't use .lower() on the word! Hopefully this helps a little bit.

Happy coding!