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 Python Basics Functions and Looping Raise an Exception

Guy Chenevert
Guy Chenevert
1,459 Points

I don't get this whole module i'm on should i just start over or can someone help me understand it?

I'm in the python basics functions module.

suggestinator.py
def suggest(product_idea):
    return product_idea + "inator"
if suggest:
    raise ValueError("3 or more characters are needed")

1 Answer

Steven Parker
Steven Parker
231,248 Points

You might want to do some review, but identifying the issues here could help in knowing what to look for:

  • a "return" stops function execution, so the added code must come before it
  • any code that is part of a function must be indented more than the "def" line
  • the "if" test should include a comparison expression, and include the required value
  • the test should refer to the argument instead of the function name
  • the requirement is about the length of the argument