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

what is wrong with my code here

suggestinator.py
def suggest(product_idea):
    return product_idea + "inator"
product_idea = input("Enter a product name")
if len(product_idea) < 3:
    raise ValueError("Sorry your idea is too short")

1 Answer

Oszkár Fehér
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Oszkár Fehér
Treehouse Project Reviewer

Hi Alwen Nyikadzanzwa. You are on the right track and your code can pass the quiz just with a little adjustments First of all, you don't need this line

product_idea = input("Enter a product name")

The product_idea it's given as a parameter What you need to do is to move you raise block inside of the function, in your code, it's outside of the function

def suggest(product_idea):
    <here comes your raise block>   --> also make sure there is no extra `tab` or any extra space when I checked your code I ran into some extra `tabs`

    return product_idea + "inator"

I hope this will help you out. Happy codding.