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 trialHara Gopal K
Courses Plus Student 10,027 Pointsdisemvowel
was wondering why this isn't working
def disemvowel(word):
word = list(word)
vowels = ["a", "e", "i", "o", "u"]
try:
for letter in word:
if letter in [v.upper() for v in vowels] or letter in vowels:
word.remove(letter)
except ValueError:
pass
word = ''.join(word)
return word
1 Answer
Alexander Davison
65,469 PointsYou are over-thinking this challenge.
You are trying to do a lot of complicated stuff, but really you don't need to do so much.
This is my pseudo-code to give you an idea of what to do:
For each item in the parameter:
If the item lowercased isn't in the list "a", "e", "i", "o", and "u", then:
Add the item to the result
Return the result
This isn't valid Python code, but it might give you an idea of how to tackle this problem.
I hope this helps
Happy C0D1NG!
~Alex
Hara Gopal K
Courses Plus Student 10,027 PointsHara Gopal K
Courses Plus Student 10,027 Pointsthank you Alex...i guess I should start thinking in reverse...i was anchored to the word remove.....i feel like removing the pro tag on my gravatar :D...don't know who gave me that...
Alexander Davison
65,469 PointsAlexander Davison
65,469 PointsYou can also accomplish this task with
remove
, too!For example: