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 trialCallum Anderson
Data Analysis Techdegree Student 10,200 PointsI am unsure what's wrong, I am getting an error about '<' when trying to create an if and raise ValueError block
def suggest(product_idea):
if product_idea = < 3:
raise ValueError("That's too short")
return product_idea + "inator"
1 Answer
Mark Sebeck
Treehouse Moderator 37,905 PointsLess than or equal to should be written as <=. No space.
Mark Sebeck
Treehouse Moderator 37,905 PointsMark Sebeck
Treehouse Moderator 37,905 PointsActually you need to check the length of the string Product_id.
Callum Anderson
Data Analysis Techdegree Student 10,200 PointsCallum Anderson
Data Analysis Techdegree Student 10,200 PointsThere's something else wrong too as in the preview this is my errors.
'<' not supported between instances of 'str' and 'int
Mark Sebeck
Treehouse Moderator 37,905 PointsMark Sebeck
Treehouse Moderator 37,905 PointsYes. 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.