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 could be wrong with my code i keep getting a SyntaxError: unexpected EOF while Parsing.

def suggest(product_idea): product_idea = (input ("wat is idea ")) if len (product_idea) >=3:

    raise ValueError ("lenght is short")
return (product_idea + "inator")

try: product_idea = (input ("wat is idea ")) print("new idea is {}".format (product_idea+"inator"))

1 Answer

Dave Faliskie
Dave Faliskie
17,793 Points

It's hard to tell what your code actually looks like because it's not formatted here, but if you have all that code on one line thats likely causing the syntax error. I also think you can remove the

product_idea = (input ("wat is idea "))

and the whole try block at the end. Also your if statement will be true if the product idea length is greater or equal to 3, you want that to be true when the product length is less then 3 so use <