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

Alexandra Ciorra
seal-mask
.a{fill-rule:evenodd;}techdegree
Alexandra Ciorra
Python Web Development Techdegree Student 796 Points

What step am I missing?

It saying its returning words still with vowels. Which step am i missing?

disemvowel.py
vowels = (""" 'A', 'a', 'E', 'e', 'I', 'i', 'O', 'o', 'U', 'u' """)
def disemvowel(word):
    if vowels in word:
        word.remove(vowels)
    return word

2 Answers

Hi Alexandra, this was my solution....

def disemvowel(word):
    vowels = ['a', 'e', 'i', 'o', 'u']
    letters = list(word)
    word_no_vowels = []
    for letter in letters:
        if letter.lower() not in vowels:
            word_no_vowels.append(letter)
    word = ''.join(word_no_vowels)
    return word

Hope it helps

Hi ! Here is another solution too :

vowels = (""" 'A', 'a', 'E', 'e', 'I', 'i', 'O', 'o', 'U', 'u' """)
def disemvowel(word):
    result = ""
    for letter in word:
        if letter not in vowels:
            result += letter
    return result

The thing is that there is no existing remove method on string...