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 this piece of code, i keep getting EOFerror every time i try to get the input from the user

the challenge is : Can you please raise a ValueError if the product_idea is less than 3 characters long? Thanks in advance!

suggestinator.py
def suggest(product_idea):
    if len(product_idea)<3:
        raise ValueError("Too Short")
    return product_idea + "inator"
try:
    product_idea=str(input("what's your idea"))
    print("{} is your idea! wow".format(suggest(product_idea)))
except ValueError as err:
    print(err)

1 Answer

Steven Parker
Steven Parker
231,269 Points

You're working to hard! The instructions don't ask you to prompt, input, try calling the function, catch exceptions, or print anything.

Your additions to the function are the whole task. Remove the other stuff and you'll pass.

Thanks, next time i'll do as i'm asked :)