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 trialishakahmed
11,359 PointsWhen word = OUacYvZ, my code removes all the vowels. BUT, when word = IUacYvZ, my code fails to remove the "I".
def disemvowel(word):
vowels = ['a' , 'e' ,'u', 'o', 'i', 'A','E' 'I', 'O', 'U']
oldword = list(word)
for a in vowels:
while a in oldword:
oldword.remove(a)
else:
continue
return "".join(oldword)
Why is this happening?
1 Answer
Jennifer Nordell
Treehouse TeacherHi there! You're doing terrific and this challenge trips up many. In your case, it's a typo. You've omitted a comma between two of the vowels in the vowel list.
You wrote:
vowels = ['a' , 'e' ,'u', 'o', 'i', 'A','E' 'I', 'O', 'U']
But you meant to write:
#note the comma betweeen the capital E and capital I
vowels = ['a' , 'e' ,'u', 'o', 'i', 'A', 'E', 'I', 'O', 'U']
On a side note, your else
block is not needed. An else is only used in conjunction with an if
statement.
Hope this helps!
ishakahmed
11,359 Pointsishakahmed
11,359 PointsLol. Thank you! I wish I figured it out earlier.