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 trial

Python

Define and raising exception problem

I have trouble starting with this function, i was re reviewing materials again and again, but no luck on how to properly fix this. Here's the code how i did that kicks on errors :(

def suggest(product_idea):

suggest = len(input("What's the product idea?"))
product_idea > 3
append += 1
if product_idea < 3:
    raise ValueError("The idea name must be longer!")

1 Answer

Steven Parker
Steven Parker
243,240 Points

Here's a few hints:

  • you don't need to "input" anything, use the parameter instead
  • nothing named "append" has been defined (or will be needed)
  • compare the length of the string instead of the string itself
  • the original "return" must still be done when the test fails