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

Raising an Exception, Basic Python, getting EOF error, what I'm doing wrong? Do i have to implement "Try block"?

def suggest(product_idea): if product_idea != input(str) == 3: raise ValueError("The product idea is less than 3 characters long") return product_idea + "inator"

1 Answer

I'm not sure on the syntax (check the link saying "markdown cheatsheet" to see how to add code on here) but where you have:

if product_idea != input(str) == 3:

Is probably the problem. str() is a function that turns something into a string. If you just put:

if product_idea != input("Enter a product idea") == 3:

The input will work, but you still have 2 comparisons on one line (not sure if that's what you're after or not). You're comparing the input with 3, and also with (not) product_idea. Perhaps it should just be:

if input("Enter a product idea") != 3:

But I'm not sure what the question is sorry!