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

suggestinator.py
def suggest(product_idea):
    return product_idea + "inator"
Steven Parker
Steven Parker
231,248 Points

There's a limit on the title length, and whatever question you were asking about this got cut off.
Please edit the body of the question to add it back in.

Yeah i'm really confused about how to do this!! Somebody help!

1 Answer

Paawan Patel
Paawan Patel
3,303 Points

I over-complicated the solution on the first few attempts (trying to apply the logic from the preceding video tutorial)

You can use a combination of an "if" function and "len" function to test the string length of "product_idea" and then "raise" a "ValueError" if the entered string doesn't meet the criteria. Enter this block above the return statement

You don't need to do anything more complicated than that.

Let me know if you're still stuck.