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 trialRamsley Brice
4,767 PointsHello I keep getting File "", line 7, in EOFError: EOF when reading a line, but the console reads my code correctly
Hello,
I tried to complete the challenge but I keep receiving an error. And I don't know why. It seems to be due to my input line 7. Would someone know why? Thanks!
def suggest(product_idea):
if len(product_idea) < 3: #test the exception
raise ValueError("This idea is too short!")
return product_idea + "inator"
try:
product_idea = input("What is your suggestion?")
idea_name = suggest(product_idea)
except ValueError as err:
print("Oh no! That's not a valid value. Try again...")
print("({})".format(err))
else:
print("Your new brand product name is {}!".format(idea_name))
5 Answers
Jordan DeLeon
1,074 PointsYour code is correct, however, the try statement should be included in the above function.
Lukas Dahlberg
53,736 PointsYou are missing the end keyword after your return statement.
Ramsley Brice
4,767 PointsBy end keyword, what do you mean? I seem to have skipped this detail.
Lukas Dahlberg
53,736 PointsNever mind that. Got my languages confused. I would check your try/catch.
Ramsley Brice
4,767 PointsOk. Thanks Anyways!
Miguel Soriano
Front End Web Development Techdegree Student 3,895 PointsHi Ramsley you only need the first 4 lines, you don't need the rest for the challenge. You're coding is already correct maybe just add "<=" in if len(product_idea) <= 3:
def suggest(product_idea): if len(product_idea) <= 3: raise ValueError("the idea is too short") return product_idea + "inator"
Ramsley Brice
4,767 PointsGreat Thanks Miguel!! It worked when I only kept the function!