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 trialMarc Vilar
8,230 Pointsproblem with grader
Even with code from internet and that I think it's doing what is supposed to, getting the
"Hmm, got back letters I wasn't expecting!"
Don't know why.
def disemvowel(word):
vowels = 'aeiou'
"".join([letter for letter in word.lower() if letter not in vowels])
return word
5 Answers
hum4n01d
25,493 PointsHi Marc Vilar, Iβm actually not sure whatβs wrong with your code but this worked for me:
def disemvowel(word):
new_word = ""
for character in word:
if not character.lower() in "aeiou":
new_word += character
return new_word
EDIT: I figured it out. Youβre doing it properly, but you forgot to return the joined string! You need to change the third line to reassign to the word
variable like this:
def disemvowel(word):
vowels = 'aeiou'
word = "".join([letter for letter in word.lower() if letter not in vowels])
return word
Alexander Davison
65,469 PointsTo add on to hum4n01d's answer, you need to also support uppercase vowels.
The challenge is also expecting "AEIOU" to be cut out of the string
You can fix this by adding .lower()
to letter
in the if
part OR you can add "AEIOU" in uppercase to the vowels
variable.
I hope this helps out. ~Alex
hum4n01d
25,493 PointsAh yes, I accounted for this in my own solution
Marc Vilar
8,230 PointsThanks all, guys.
hum4n01d
25,493 PointsCould you mark one of the answers as correct?
Marc Vilar
8,230 PointsHi,
I marked one as best answer, isn't that what I had to do? If not, don't know how, sorry, if you can explain, I will do it.
hum4n01d
25,493 PointsNo, you did it right but I posted my comment before you marked it :)
Marc Vilar
8,230 Pointsah, ok,
Thanks again for taking the time to reply my doubt.
hum4n01d
25,493 PointsNo problem!
Alexander Davison
65,469 PointsAlexander Davison
65,469 PointsHi hum4n01d long time no see :)
I'm xela888
hum4n01d
25,493 Pointshum4n01d
25,493 PointsAlexander Davison Hi!
Alexander Davison
65,469 PointsAlexander Davison
65,469 PointsHello there :)