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

Hello, I have a problem with this challenge...

The Editor says, that I can't compare int with str. That makes sense to me. But I do not know how I can compare the string of "product_idea" with the 3 characters... Could you please help me?

suggestinator.py
def suggest(product_idea):
    if product_idea < 3:
        raise ValueError ("...")  
    return product_idea + "inator"

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there, christophgutsche ! It might have been a while since you've seen this video, but there was a method covered there around 0:21 called len. You can get the length of any string by passing it into that method. Here's an example:

course = "Python"
course_length = len(course)

#course_length will now be equal to 6 because that is the length of "Python"

I think you can get it with this hint, but let me know if you're still stuck! :sparkles: