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 trialSuresh N
743 PointsGetting an error in a Challenge Task on Raising exceptions: The 'code' i wrote is executing without error in Workspace,
the attached code is working without error in Workspace, whereas its throwing "Bummer" in challenge window. pls help
def suggest(product_idea):
if length < 3:
raise ValueError("The idea has to be more than 3 characters long. Try again")
return product_idea + "inator"
try:
product_idea = input("Whats your idea?")
length = int(len(product_idea))
idea = suggest(product_idea)
except ValueError as err:
print("Oops! We ran in to an issue.({})".format(err))
else:
print("The name of the idea is {},".format(idea))
1 Answer
Alexander Davison
65,469 PointsYou don't need to call the function. The challenge only told you to fix up the function, not to call it or receive input. Other than that, you have the right idea.
Try this:
def suggest(product_idea):
if len(product_idea) < 3:
raise ValueError("The idea has to be more than 3 characters long. Try again")
return product_idea + "inator"
Suresh N
743 PointsSuresh N
743 PointsThank you
Alexander Davison
65,469 PointsAlexander Davison
65,469 PointsYou're welcome! :)
Remember to hit the Best Answer button if the answer helped you!