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

chris d
chris d
1,251 Points

disemvowel

Hello,

Anyone have any tips as to why this code keeps failing the disemvowel task

disemvowel.py
def disemvowel(word):
    vowels = ['a','e','i','o','u','A','E','I','O','U']
    word = list(word)
    for letter in vowels:
        while letter in word:
            word.remove(letter)
    word = ' '.join(word)
    return word

1 Answer

Patrick Madden
Patrick Madden
1,632 Points

Hey chris d,

You're gonna kick yourself because it's something super simple, but it looks like the only issue is the space in between the single quotes in your join operation. Should be...

word = ''.join(word) #no space between single quotes

Your code will still return the given string without vowels however, with spaces between the letters. For the code challenge there should be no space.

Hope this helps man.

chris d
chris d
1,251 Points

wow, thank you very much Patrick. you were right, once i removed the space it passed.

i appreciate your help kind sir