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

whats wrong now????

suggestinator.py
def suggest(product_idea):
    return product_idea + "inator"
if suggest >= 3:
    raise ValueError("The product idea is too short!!")
else:
    print("confirmed!")

3 Answers

Jeff Muday
MOD
Jeff Muday
Treehouse Moderator 28,716 Points

You got in there and tried it-- we can build on that. You'll need to change your logic by moving the check of the product_idea length like this

len(product_idea)

And this has to happen BEFORE you return the suggestion. Finally, you'll have to change the indent level to match your block logic. Something like this:

def suggest(product_idea):

    # corrected as per Steven Nicholl
    #if  len(product_idea) >= 3:

    if len(product_key) <= 3:
        raise ValueError("The product idea is too short!!")

    return product_idea + "inator"

Good luck with your Python journey!

It looks like the less than or equals sign is actually flipped, should be <=3

Jeff Muday
Jeff Muday
Treehouse Moderator 28,716 Points

I corrected the error, sorry for making it!

No worries, errors are part of the journey! And thanks for the original response, it helped make sense of the problem.