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 trialfilmon araya
674 Pointsi cant answer this question
can i get the asnswer for this question
def suggest(product_idea):
if len(product_idea) < 3
raise valueError
return product_idea + "inator"
2 Answers
Jason Anders
Treehouse Moderator 145,860 PointsHi Filmon,
The Community is not a place where answers are just given out. It is a place to come for help and hints.
With that in mind, you are on the right track. There are just a few things not quite right with some syntax and naming.
- First, the
if statement
is missing the colon need to open it's block. - Python is case sensitive, so
valueError
is not the same asValueError
... you needValueError
- Also, Python is very indent specific. Right now, the
return statement
is inside theif statement
. It needs to be outside that, but still inside the function.
I'm sure you can get it now. :)
Nice work so far!
Ben Hedgepeth
Python Web Development Techdegree Student 10,287 PointsYou have syntax and name errors and indentation issues with your code.
You need a :
on your conditional statement. For any error you want to except/raise, it must be title-cased and must have ()
at the end. Think of it as if you're calling an error on purpose.
Try to figure out how the block is supposed to be structured in the context of a True/False situation.
Jason Anders
Treehouse Moderator 145,860 PointsHi Ben Hedgepeth ,
Actually ValueError
without any parentheses is correct syntax. It's a Python Exception and does not take ()
after the name. You can have a look at the Errors and Exceptions Docs for some examples. Or these Raise Exception Examples.
filmon araya
674 Pointsfilmon araya
674 Pointsthank you i like your put it.