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 trialYan Chan
1,940 PointsNot sure what I have done wrong...
Please could you have a look at my codes?
def disemvowel(word):
vowel=["a","e","i","o","u"]
for letter in vowel:
try:
word.remove(letter)
except ValueError:
pass
try:
word.remove(letter.upper())
except ValueError:
pass
return word
1 Answer
Steven Parker
231,236 PointsYou're applying remove to a string, but it's a method for lists.
Also, you'll need to account for words that have more than one of the same vowel, but the remove function only removes the first occurrence.
Perhaps you intended to use replace instead?
Yan Chan
1,940 PointsYan Chan
1,940 PointsThank you