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 trialBogdan Radu
Courses Plus Student 216 PointsCan someone please explain this error? ERROR: test_exception_not_raised (__main__.TestRaiseExecution)
def suggest(product_idea):
if product_idea != 4:
raise ValueError("Product names need to have 4 or more characters")
return product_idea + "inator"
print("Product name too short! Try again...")
1 Answer
Steven Parker
231,275 PointsYou're getting close, here's some hints:
- you need to check the length of the idea string, not the string itself
- the exception should only be raised if the length is less than 3
- the "return" should not be controlled by the "if"
- all the code should be done inside the function
- you don't need to "print" anything
Bogdan Radu
Courses Plus Student 216 PointsBogdan Radu
Courses Plus Student 216 PointsThank you very much:)
Bogdan Radu
Courses Plus Student 216 PointsBogdan Radu
Courses Plus Student 216 PointsI cannot do it, I understand what I need to do but I don't know how...
Steven Parker
231,275 PointsSteven Parker
231,275 PointsOK, a more explicit version of the same hints: