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 trial

Python Python Basics Functions and Looping Raise an Exception

raise an exp

suggestinator.py
def suggest(product_idea):
    return product_idea + "inator"
    raise ValueError("Are you sure you don't get it?")

understand = input("Do you understand?  ")
if understand != "yes":
    raise ValueError("Are you sure you don't get it?")

1 Answer

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,457 Points

Hi Mohammed, There are some issues with your code:

  • The input statement causes the challenge checker to fail since it is not expecting to supply input. The checker will only call the defined function with various values to determine if it is working correctly.
  • The raise statement is after the return statement making the function always return before reaching the raise.
  • There is not conditional if statement before the raise statement to only run the raise statement if the length of the input product_idea is less than 3 characters long.

Post back if you need more help. Good luck!!