Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Python Collections (2016, retired 2019) Lists Disemvowel

Doyle Lardell
PLUS
Doyle Lardell
Courses Plus Student 888 Points

perplexed

cant get it

disemvowel.py
def disemvowel(word):
    vowel = ['a', 'e', 'i', 'o', 'u', 'A', 'E', "I", 'O', "U"]

    try:
        word.remove(vowel)
    except ValueError:
        pass
        return word
Alex Koumparos
seal-mask
.a{fill-rule:evenodd;}techdegree
Alex Koumparos
Python Development Techdegree Student 36,862 Points

You haven't given enough detail about what you are trying to accomplish or where you're stuck.

Try reading this helpful guide from Stack Overflow on 'How Do I Ask a Good Question' and rephrase your question to make it easier for people to help you.

1 Answer

Steven Parker
Steven Parker
216,136 Points

The "word" argument is a string, and strings do not have a "remove" method. Perhaps you were thinking of "replace"?

Or you could also convert the string into a list and then you could use "remove", but you'd need to convert it back later.

Either way, you'll probably need a loop since both methods take only scalar (not list) arguments.