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 trialgokulprasath k M
1,344 Pointsdisemvowel bummer shows "Try again"
need help
def disemvowel(word):
word =["a","e", "i", "o", "u"]
for letter in word:
try:
letter.remove("a")
except ValueError:
pass
try:
letter.remove("e")
except ValueError:
pass
try:
letter.remove("i")
except ValueError:
pass
try:
letter.remove("o")
except ValueError:
pass
try:
letter.remove("u")
except ValueError:
pass
return word
1 Answer
Jon Mirow
9,864 PointsHi there,
It really helps if you first test your code in a workspace, on your machine or an online environment (like here )
The error you should see is
File "python", line 9, in disemvowel
AttributeError: 'str' object has no attribute 'remove'
What's happening is your for loop goes letter by letter through the string, but .remove is a list method, so you get an AttributeError and the script crashes. Also have a look at your nameing - you have an argument called word, and the first thing that happens is it gets overwritten by a list of vowels :)
Hope it helps!