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 trialBenedict Ojuolape
1,834 PointsEOFError
Hi guys,
I'm not sure why I'm getting an EOF Error here.
Please advise.
def disemvowel(word):
word = input("What is your favourite colour?\n> ")
remove_vowels = ["A","E", "I", "O", "U", "a", "e", "i", "o", "u"]
try:
word.remove(remove_vowels)
except ValueError:
pass
return word
1 Answer
Chris Freeman
Treehouse Moderator 68,441 PointsThe input
statement is not needed. The challenge checker will call the function by supplying a string argument. This string will be automatically assigned to word
. By including the input
statement, the checker hangs since it is not expecting to supply any input.
Also, since word
is a string (type str
), the isn't a .remove()
method available.
Post back if you need more help. Good luck!
Benedict Ojuolape
1,834 PointsBenedict Ojuolape
1,834 PointsThanks Chris, can I create a .remove() method or is that not necessary?
Ben
Chris Freeman
Treehouse Moderator 68,441 PointsChris Freeman
Treehouse Moderator 68,441 PointsYou can not add methods to built-in types such as
str
. You could create your own class that extendsstr
but that is way beyond what is necessary to solve this challenge.