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 trialpriyanka shukla
3,051 Pointswhy its not runnnig properly
def disemvowel(word): word_as_list=list(word) for letter in word_as_list: character=letter.lower() if character in vowels: word_as_list.remove(letter) word=''.join(word_as_list) return word
vowels=['a','e','i','o','u','A','I','E','O','U']
def disemvowel(word):
word_as_list=list(word)
for letter in word_as_list:
if letter in vowels:
word_as_list.remove(letter)
word=''.join(word_as_list)
return word
1 Answer
Steven Parker
231,122 PointsIf you remove elements from an iterable while it is controlling a loop, it can cause other elements to be skipped over. You could use a copy of the list for iteration, but an even easeir fix would be to use the original word as the loop iterable while you work on the list.