Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Rakshit H Ravishankar
1,309 Pointsdisemvowel.py not working
def disemvowel(word): word=list(word) for it in word: if( it=='a' or it=='A' or it=='e' or it=='E' or it=='i' or it=='I' or it=='o' or it=='O' or it=='u' or it=='U'): try: word.remove(it) except ValueError: pass word = ','.join(word) return word
This is the script I am using. But this is not passing the test. It is throwing an error saying that 'got some vowels back' Can anyone help me here?
def disemvowel(word):
word=list(word)
for it in word:
if( it=='a' or it=='A' or it=='e' or it=='E' or it=='i' or it=='I' or it=='o' or it=='O' or it=='u' or it=='U'):
try:
word.remove(it)
except ValueError:
pass
word = ','.join(word)
return word
1 Answer

Alexander Davison
65,468 PointsYou might be over-thinking this challenge.
It seems that you make this code DRY-er (DRY stands for Don't Repeat Yourself) by using the in
keyword:
def disemvowel(word):
result = ''
for letter in word:
if letter.lower() not in 'aeiou':
result += letter
return result
Good luck! ~Alex
Questions? Please ask below