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

Bruno Aldo Lunardi
Bruno Aldo Lunardi
15,795 Points

Problems with this challenge

Problems with this challenge, it's working on my python shell here, for some reason, though, I'm not passing the challenge....

disemvowel.py
def disemvowel(word):
    words = list(word)
    vowels = ["a","e","i","o","u","A","E","I","O","U"]
    for char in vowels:
        while True:
            try:
                words.remove(char)
            except ValueError:
                pass
                break
    return str(words)

2 Answers

james south
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
james south
Front End Web Development Techdegree Graduate 33,271 Points

string casting a list does not do anything. you need to use the join method on the list to turn it into a word. join is called on the delimiting string with the argument being the collection whose elements you want to join, so here you don't need a delimiter since you're trying to make a word, so use the empty string (two single quotes) ''.join(myList) like that. also you don't need to pass before you break so that can be removed.

Bruno Aldo Lunardi
Bruno Aldo Lunardi
15,795 Points

Thanks mate!! The proposed changes have been made and I passed the challenge! :D