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

David Garcia
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
David Garcia
Python Development Techdegree Graduate 11,254 Points

I don't understand what it wants me to do i've tried everything i thought of..i think it might be in the Try function

i did every thing i thought of help

suggestinator.py
def suggest(product_idea):
    if product_idea <= 3:
        raise ValueError("your product idea has less than 3 characters in it")
    return product_idea + "inator"

try:

except ValueError as err:
    print("({})".format(err))

1 Answer

Henrik Christensen
seal-mask
.a{fill-rule:evenodd;}techdegree
Henrik Christensen
Python Web Development Techdegree Student 38,322 Points

The function looks almost okay, the only mistake is that you should check if it's less than 3 and NOT less than OR equal to 3 :-)

def suggest(product_idea):
    if product_idea <= 3:  # should be < 3
        raise ValueError("your product idea has less than 3 characters in it")
    return product_idea + "inator"
David Garcia
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
David Garcia
Python Development Techdegree Graduate 11,254 Points

thanks for the help but i am still having trouble it wants me to do something else and i cant put my hand on it, ill be messing with it some more to see if i can do it