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

Sévak Kulinkian
Sévak Kulinkian
1,086 Points

def disemvowel(word): should work ...

Hey, I wrote this piece of code for the function which deletes vowels:

def disemvowel(word): word = "".join(letter for letter in word if letter not in voyels_list) return word

It works perfectly fine in my Terminal, it does the job properly, but My online Workspace tells me "Hmm, got back some unexceptected letters" ...

What can I do ?

disemvowel.py
voyels_list = ["e","a","u","i","o","y","E","A","U","I","O","Y"]

def disemvowel(word):
    word = "".join(letter for letter in word if letter not in voyels_list)
    return word

disemvowel("commEnT tu VAs papa ? ")

2 Answers

Stuart Wright
Stuart Wright
41,119 Points

Hi Sévak - I don't understand why that is. I just copy/pasted your code exactly into the challenge, removed "y" and "Y" from the list, and it worked:

voyels_list = ["e","a","u","i","o","E","A","U","I","O"]

def disemvowel(word):
    word = "".join(letter for letter in word if letter not in voyels_list)
    return word

disemvowel("commEnT tu VAs papa ? ")
Sévak Kulinkian
Sévak Kulinkian
1,086 Points

Lol okay ... so it must be a bug from treehouse.com ... I checked and indeed the function does the job in my Terminal! Thanks so much for your help Stuart :)

Stuart Wright
Stuart Wright
41,119 Points

The challenge does not consider Y to be a vowel. Simply remove 'Y' and 'y' from your vowels list and your code will pass the challenge.

Sévak Kulinkian
Sévak Kulinkian
1,086 Points

Hey Stuart, thanks for your help! I removed the "y" & "Y" and still not working... don't know why ...