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

I don't know whats wrong with this . please help?

def suggest(product_idea): return product_idea + "inator" if len(product_idea) < 3: raise ValueError

Why does this not work? It gives off error messages? Not sure what to do.

5 Answers

Based on what you've posted, it looks like your code is returning the idea string regardless of what length it is. The function should first check the length of the product_idea, and only return the string if the if statement does not evaluate to true.

Let me know if this helps here

Josh Keenan
Josh Keenan
19,652 Points

What challenge is this for?

Alexander Besse
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Alexander Besse
Full Stack JavaScript Techdegree Graduate 35,115 Points

Please go into the challenge this is for, click "Get Help" and make sure the "Share code" checkbox is marked. This will help us a lot, so we can help you. :)

Haisam Elkewidy
Haisam Elkewidy
26,987 Points

You need to put the if statement before this line:

return product_idea + "inator"

Because otherwise, it will just return a string regardless of the length. Code is being read from top to bottom.

I appreciate all the help but it just will not play through. I don't know if it's me or what? I have done fine up to this point it just will not work. Thank you for all the help.