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 trialJason Loveless
726 PointsTrying to complete this challenge but I am struggling pls help
Can you please raise a ValueError if the product_idea is less than 3 characters long? product_idea is a string.
def suggest(product_idea):
product_idea = input("What is your idea?")
if int(product_idea) <= 3:
raise ValueError("Too few characters")
return product_idea + "inator"
2 Answers
Steven Parker
231,248 PointsThe product idea is provided as an argument, you won't need to "input" anything.
Also, you want to test the length of the argument instead of trying to convert it directly into a number.
Jason Loveless
726 Pointsthank you very much !
Jason Loveless
726 PointsJason Loveless
726 Pointsreally confused, please could you send me some example code
Steven Parker
231,248 PointsSteven Parker
231,248 PointsYou nearly have it, just:
int(product_idea)
" to "len(product_idea)
"