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 trialRaduica Sebastian
Courses Plus Student 1,356 Pointsvowels
dosen't work..:(
def disemvowel(word):
sebi=list(word)
vowels=["a","e","i","o","u","A","E","I","O","U"]
for letter in sebi:
if letter in vowels:
sebi.remove("letter")
word=",".join(sebi)
return word
2 Answers
Donatas Ramanauskas
28,538 Pointsfew thinks are wrong, lines 6 and 7 I think are just typos, should be:
sebi.remove(letter)
word="".join(sebi)
That would still not pass, because when you're removing chars from the list while iterating through it, you're changing the indexes of list members and some chars would not be checked against the condition. I think it would be better to just create empty list and append members that satisfy the condition, this passed:
def disemvowel(word): sebi=list(word) vowels=["a","e","i","o","u","A","E","I","O","U"] disemvoweled = [] for letter in sebi: if letter not in vowels: disemvoweled.append(letter)
return "".join(disemvoweled)
Raduica Sebastian
Courses Plus Student 1,356 PointsThank you very much!!