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

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 26,999 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 26,999 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.