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

Leo Marco Corpuz
Leo Marco Corpuz
18,975 Points

Removing vowels from string

Can anyone check my code and see what's wrong with it.I'm not sure what the error is. Thanks

disemvowel.py
def disemvowel(word):
    string=list(word)
    copyString=string.copy()
    for letter in string:
        if letter.upper=="A" or letter.upper=="E" or letter.upper=="I" or letter.upper=="O" or letter.upper=="U":
            try:
                copyString.remove(letter)
            except ValueError:
                continue


    return word

1 Answer

  • You are returning the same value being passed in. copyString was what was modified.
  • upper methods should end with parentheses