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

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

def suggest(product_idea):
    return product_idea + "inator"

2 Answers

  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
230,248 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