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 trialLeslie Lewis
1,088 PointsMy code works fine in my own terminal
No errors when I run this on my own machine
def suggest(product_idea):
if len(product_idea) < 3:
raise ValueError("Too short!")
return product_idea + "inator"
try:
idea = input("Your idea: ")
product_name = suggest(idea)
except ValueError as err:
print("Try again - {}".format(err))
#print("{}".format(err))
else:
print("Your product name: {}".format(product_name))
2 Answers
Steven Parker
231,248 PointsMuch of this code seems to be your own version of a validation system, which isn't needed in the challenge itself (and confuses it!).
For the challenge, the instructions only ask you to change the function itself. You won't need to call it, or use "try" or "except", or to "input" or "print" anything.
Ritik Parihar
2,169 Pointschallenge only requires you to change the product idea if: statement
def suggest(product_idea): if product_idea < "abc" : raise ValueError("too short") return product_idea + "inator"
Jeremy Charles
Courses Plus Student 643 PointsJeremy Charles
Courses Plus Student 643 PointsYour code works with your function definition alone. I'm not sure what tests they are throwing at your code that would cause it not to pass.