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 trialErwan Mba Mba
2,711 PointsPlease any suggestion on how to solve this challenge???
I don't know if there is something that I'm missing.
def suggest(product_idea):
if product_idea < 3 words:
raise ValueError ("product_idea is less than 3 characters long")
return product_idea + "inator"
2 Answers
Christian Beckett
11,123 PointsHi The whole point of the challenge is to raise a value error so in order to do so you must take the len() of the code making the code for it if len(product_idea) < 3: raise ValueError ("product_idea is less than 3 characters long") or whatever you would like ot make it.
Megan Amendola
Treehouse TeacherHi! The challenge is looking for you to raise an error if the product_idea
being passed in is less than 3 characters not words. In your code, words
is not defined. It doesn't exist anywhere and Python doesn't know what this variable is. In order to know how many characters are in a string, you need to use len()
and then see if it is less than 3. If so, you raise the error, but the error should be inside of the if block, right now it is outside of the if block so the error runs every time. The amount of spaces or tabs is important in Python, so you need to tab your raise statement over so it is like this:
if len(product_idea) < 3:
raise ValueError ("product_idea is less than 3 characters long")
Erwan Mba Mba
2,711 PointsThank You Megan!!!