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 trialGary Anderson
235 PointsWhat's wrong?
Again, I don't know what's the problem, my head is burning right now. :(
def disemvowel(word):
for letter in word:
if letter.lower() == "a" or letter.lower() == "e" or letter.lower() == "i" or letter.lower() == "o" or letter.lower() == "u":
try:
word.remove(letter)
except ValueError:
pass
return word
1 Answer
Andreas cormack
Python Web Development Techdegree Graduate 33,011 PointsHi Gary
A string does not have a method called remove, or not that i know of. Instead, if a letter is indeed a vowel just do a pass. see example below.
def disemvowel(word):
tmp = ""
for letter in word:
if letter.lower() in "aeiou":
pass
else:
tmp+=letter
return tmp