Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
How to raise an Exception. What I'm doing wrong with my coding? This is my code:def suggest product_idea: return pro
def suggest product_idea: return product_idea + "inator" if product_idea <3: raise ValueError(" ")
Thanks Cameron, I appreciate you help.
Cameron ChildresTreehouse Moderator 11,720 Points
Some things to point out:
- The parentheses originally included in the function are necessary to set the parameters, don't remove them
- A string and an integer can't be compared with the ">" operator, so you'll need to use the len() function on
product_ideato convert it to a number representing its length
- Your "if" statement is outside of the function -- we want the error to be raised as part of the function, before anything is returned
I hope this helps steer you in the right direction! Let me know if you need any further assistance.
Honestly, I don't get the idea.