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

Is my logic wrong?

Hi guys,

I've listed all vowels, and all upper case vowels, and then removed those 2 lists, How can I solve this problem?

Thank you :)

disemvowel.py
def disemvowel(word):

    vowel_list = ["a", "e", "i" ,"o", "u"]
    vowel_upper_list = vowel_list.upper()

    word.remove(vowel_list)
    word.remove(vowel_upper_list)

    return word

2 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi again! Treehouse is sending in a string and wants you to remove the vowels from the string. But strings are immutable and you cannot use the remove method on a string. Take a look at the hints that I posted for you as an answer to your question here.

Hope this helps! :sparkles:

.remove() - A list method that removes items from a list by their value. My_list = [1, 2, 3, 1] // so our list has two 1’s in it and we don’t want that so lets try and get // rid of one of them. My_list.remove(1) // (1) 1 is the value that I want to remove, alright, so we need to get rid of //both of them , so let’s see what it did

my_list [2, 3, 1] // is displayed, didn’t do what we expected, that’s because remove, removes the // first instance of a variable from the list.