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 trialadrian dc
402 Pointsproblem with solution code
Can anyone tell me what is wrong with my code for this particular challenge? Also, why do I get an EOF error using input
def suggest(product_idea):
if len(product_name)< 3:
raise ValueError("Length of the word is less than three characters long")
grand_total = str(product_idea) + "inator"
return grand_total
try:
product_name = input("Enter a product string")
final_name = suggest(product_name)
except ValueError as err:
print("That is not a correct entry")
print("{}".format(err))
else:
print("The product name is {}".format(final_name))
1 Answer
Chris Freeman
Treehouse Moderator 68,441 PointsThe code from the input statement to the end should be removed as it confuses the checker.
The function should only reference the parameters. The challenge checks behavior by calling the function. It does not have data to feed an input statement when it is not expected. So the EOF is from unexpectedly reaching the end of the *behavior checkβ script, not necessarily the end of your code.
Post back if you need more help. Good luck!!!