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 trialAbhishek Dokania
893 PointsThis code worked for me in ipython notebook but not working here
def disemvowel(word):
temp_list = []
temp_list.extend(word)
for item in temp_list:
if item.lower() in ["a", "e", "i", "o", "u"]:
temp_list.remove(item)
word = "".join(temp_list)
return word
def disemvowel(word):
temp_list = []
temp_list.extend(word)
for item in temp_list:
if item.lower() in ["a", "e", "i", "o", "u"]:
temp_list.remove(item)
word = "".join(temp_list)
return word
1 Answer
Anshu Aradhyula
4,317 PointsIt's still buggy. As a test case try typing in "aaaaaaaaaaa" or some other vowel repeatedly.
When removing elements from a list within a for loop, you are changing the size of the loop. This makes it function differently and thus skips some letters.
Try using a while loop instead.