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

Callum Anderson
seal-mask
.a{fill-rule:evenodd;}techdegree
Callum Anderson
Data Analysis Techdegree Student 10,200 Points

I am unsure what's wrong, I am getting an error about '<' when trying to create an if and raise ValueError block

suggestinator.py
def suggest(product_idea):
    if product_idea = < 3:
        raise ValueError("That's too short")
        return product_idea + "inator"

1 Answer

Mark Sebeck
MOD
Mark Sebeck
Treehouse Moderator 38,105 Points

Less than or equal to should be written as <=. No space.

Mark Sebeck
Mark Sebeck
Treehouse Moderator 38,105 Points

Actually you need to check the length of the string Product_id.

Mark Sebeck
Mark Sebeck
Treehouse Moderator 38,105 Points

Yes. You need to use the len() function to find the length of the string. Also you need to move your return statement back to line up with the if. As it is it will only return if the code gets inside the if.