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

need help

I've tried everything I know how to solve this problem. I've rewatched the video and have reviewed my notes in Workspaces but am struggling to get the correct answer. also, it tells me that '<' not supported between instances of 'str' and 'int'

suggestinator.py
def suggest(product_idea):
    if product_idea < 3:
        raise ValueError("This name is too short!")

    return product_idea + "inator"

1 Answer

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

Hey Chris,

You are on the right track. You're just missing one small step.

Right now, the if statement is checking the variable against the integer 3. But the variable is a string. What you need to be checking is the length of the string. For this you'll need to use Python's len() method on the variable being compared in the if statement.

I'm sure you'll get it now! Nice work. :) :dizzy: