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 trialDharmesh Nayee
1,090 PointsWhat is wrong with my code?
I cant see where i am making a mistake?
def suggest(product_idea):
return product_idea + "inator"
product_idea = input ("Suggest a Product Idea?")
if len(product_idea)<3:
raise ValueError("Product idea needs to have more than 3 characters")
1 Answer
Ewerton Luna
Full Stack JavaScript Techdegree Graduate 24,031 PointsHey! The only problem I'm seeing is that you want the input to be more than 3 characters (meaning that the input should be at least 4 characters long), but you are only raising an error if your values are less than 3 characters, meaning that if you enter "bob" for example, no exceptions will be raised because it is accepting a 3 character string.
I think what you meant is this:
if len(product_idea) <= 3: # less than or equals to 3
raise ValueError("Product idea needs to have more than 3 characters")
Dharmesh Nayee
1,090 PointsDharmesh Nayee
1,090 PointsHey, Thank you for your help!