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 trialMasline Nyasha Petro
4,280 Pointsl 've madan exception can you please a ValueErrorif the product_idea is less than 3 characters long? thanks in advance.
l 've made a function that creates brand new products names using artificial interlligence. l have a problem though,people keep on adding product ideas that are too short it makes the suggetion looks bad. can you please raise a ValueError if the product_idea is less than 3 characters long?thanks in advance.
1 Answer
Adam N
70,280 Pointsdef suggest(product_idea):
if len(product_idea) < 3:
raise ValuError
return product_idea + "inator"
If the length of the string passed to the func is less than 3, raise the error. The func won't return a value unless the string is the desired length.
nakalkucing
12,964 PointsHi adam n! Just so you know, It is frowned on to simply give someone the finished code. :) Good luck! Hope this helps, Nakal
Adam N
70,280 Pointsnakalkucing does my code pass the challenge?
nakalkucing
12,964 Pointsnakalkucing
12,964 PointsHi Masline Nyasha Petro! I'd love to help. But what exactly is your question? If you could explain your question and include your problem piece of code it would be much appreciated. Best, Nakal :)