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 trialAlwen Nyikadzanzwa
1,541 Pointsplease help Iam having problems with this question
please help. Iam failing to go through this question
def disemvowel(word):
return word
word.lower()
for letter in word:
if letter == "a":
word.remove("a")
elif letter == ("e"):
word.remove("e")
elif letter == ("i"):
word.remove("i")
elif letter == ("o"):
word.remove("o")
elif letter == ("u"):
word.remove("u")
2 Answers
Clayton Perszyk
Treehouse Moderator 48,850 Pointsa return statement breaks out of the function call and nothing after is processed.
Steven Parker
231,275 PointsClayton makes a good point, you'll probably want to save the return for the end of the function.
But two other things you might need to be aware of:
- calling the "lower" method does not change the string, you need to assign it to something
- modifying an iterator within the loop can cause items to be skipped over, use a copy to control the loop