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 trialVidhya Sagar
1,568 PointsRemoving vowels .
Code works fine in Workspaces, If i am doing something wrong please point it out .
def disemvowel(word):
vowel_list=list("aeiou")
word=list(word.lower())
for vowel in vowel_list:
while True:
try:
word.remove(vowel)
except:
break
output="".join(word)
return output
2 Answers
Alexander Davison
65,469 PointsThe challenge expects you to remove both lowercase and uppercase vowels.
Your program seems to only remove lowercase vowels.
In other words, good work making your program!
I hope this helps.
~Alex
Vidhya Sagar
1,568 PointsAhhh thanks man ..
Alexander Davison
65,469 PointsNo problem :)
Vidhya Sagar
1,568 PointsVidhya Sagar
1,568 PointsYeah, but i made all the letters in the word lower case so all the vowels in the word will also be lowercase right ? Check out this line
word=list(word.lower())
Alexander Davison
65,469 PointsAlexander Davison
65,469 PointsNo, the challenge doesn't want you to return a lowercase string!
For example, If I input "PineappleApple", the code challenge wants the output to be "Pnpplppl", not "pnpplppl"!
You shouldn't lowercase the entire string at the beginning. It might affect the output to be all lowercase!
To fix this, I would remove the
.lower()
part fromword = list(word.lower())
and add all the uppercase vowels to thevowel_list
.