Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Python Basics Functions and Looping Raise an Exception

I've made a function that creates brand new product names using "artificial intelligence". I have a problem though, pe

suggestinator.py
def suggest(product_idea):
    return product_idea + "inator"

2 Answers

shahar galon
shahar galon
4,323 Points
  1. first of all you need to check if the value is correct by len function for exemple : if len(product_idea) <= 3:

  2. you need to raise an ValueError

3, then should be the return if the value is bigger then 3.

Steven Parker
Steven Parker
221,451 Points

Your question got cut off, but some general hints:

  • you'll need to add a conditional test ("if") to check the length of the "product_idea"
  • based on the test, your code will "raise" the exception specified in the instructions