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 trialjp28
3,413 PointsWhy mi code is not working
Treehouse is telling me t odo a devowel function and i did it but it's telling me Bummer Try again!
def disemvowel(word):
vowels = ["A", "E", "I", "O", "U"]
for letter in word:
if letter.upper() in vowels
word = word.replace(vowel, "")
return word
2 Answers
Chris Howell
Python Web Development Techdegree Graduate 49,702 PointsYou are very very close. Take another look at your logic for your replace method. :)
def disemvowel(word):
vowels = ["A", "E", "I", "O", "U"]
for letter in word:
if letter.upper() in vowels:
word = word.replace(vowels, "") # vowels is a List, but should be the Character you want to replace.
return word
Chris Howell
Python Web Development Techdegree Graduate 49,702 PointsYou have a few errors in there.
def disemvowel(word):
vowels = ["A", "E", "I", "O", "U"]
for letter in word:
if letter.upper() in vowels # <- syntax error, missing :
word = word.replace(vowel, "") # indentation error and vowel variable doesnt exist.
return word
jp28
3,413 Pointsi've already fixed it but i still get the bummer try again error!
( fixed: wrapped code snippet in backticks )
def disemvowel(word):
vowels = ["A", "E", "I", "O", "U"]
for letter in word:
if letter.upper() in vowels:
word = word.replace(vowels, "")
return word
jp28
3,413 Pointsjp28
3,413 PointsThank you i pass the challange :)