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 trialIdan shami
13,251 Pointschallenge remove
I don't understand why it's not working, please help.... at first, i tried
if letter == ("(letters in the challenge)"):
continue
def disemvowel(word):
for letter in word:
if letter == ("a", "e", "i", "o", "u").lower():
letter.remove
return word
1 Answer
Chris Freeman
Treehouse Moderator 68,441 PointsThe syntax error is a tuple does not have a lower()
method. Here is one approach:
- create an empty list as a placeholder for the solution, say,
results = []
- create a list of the vowels to compare with
vowels = ['a', 'e'... etc
- the
for
loop is OKfor letter in word
- check if
letter.lower()
is in vowel list - if not in vowel list, append to the
results
list - after comparing all letters in word, then use
"".join(results)
to create the word to return
Post back if you need more help. Good luck!!