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 trialjohn knight
Courses Plus Student 9,155 PointsI Need help on the "Raise a exception "quiz
Hello guys, lately I Have tried every single method to Achieve the whole lesson. i perfer seeing the whole solution.
def suggest(product_idea):
Idea = len("dende")
if Idea < 3:
raise ValueError("the product idea is less than 3 characters long")
return product_idea + "inator"
1 Answer
Chris Freeman
Treehouse Moderator 68,454 PointsYou are very close! You need to check the length of the passed in argument instead of checking the length of the fix string "dendeβ.
Post back if you need more help. Good luck!!!
john knight
Courses Plus Student 9,155 Pointsjohn knight
Courses Plus Student 9,155 PointsI'm sorry to say but I Tried doing that. it might be that I Don't get what you mean by "Arguments". So can you give me a little hand here please?. that'll be appreciated :D
Chris Freeman
Treehouse Moderator 68,454 PointsChris Freeman
Treehouse Moderator 68,454 PointsThere are two general terms referring to data passed to a function: parameter and argument
When defining a function, the parameters are listed in parens following the name of the function. Below,
product_idea
is the parameter:def suggest(product_idea):
When a function is called, a list of arguments are listed in parens followers no the function name. If no argument are supplied, the parens are empty.
The code challenge checker will call your function with various arguments to evaluate its behavior. Since your code does not utilize the
product_idea
parameter, using instead a fixed string "dendeβ, then the lengthIdea
will always 5 and theValueErrror
would never be raised.So, replace
"dende"
withproduct_idea