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

**[SOLVED]** Please point me in the right direction, my code is as follows:

def suggest(product_idea): if product_idea <3: raise ValueError("please enter more than 3 characters.") else: return product_idea + "inator"

suggestinator.py
def suggest(product_idea):
    if product_idea <3:
        raise ValueError("please enter more than 3 characters.")
else:
    return product_idea + "inator"

Nevermind I figured it out, I forgot about the len thing.

def suggest(product_idea): if len(product_idea) < 3: raise ValueError("that suggestion will not work.") return product_idea + "inator"

Dave StSomeWhere
Dave StSomeWhere
19,870 Points

Try reviewing your indentation as a start in the right direction :smile:

Well done Dave... That helps nobody. Code works fine now.

Jason Anders
Jason Anders
Treehouse Moderator 145,860 Points

Hi luke heald

Dave StSomeWhere was completely correct in pointing out the syntax error involving the incorrect indentation in your code.

Also, duplicating your comment with the code to the answers and marking your own answer as the "Best Answer" is not proper etiquette in the Community. This is frowned upon.

In regards to posting code. Please use Markdown when posting code in the Community. Unformatted code is very hard to read, and with Python especially, it is actually impossible to troubleshoot code because Python is very indent reliant, which cannont be determined with unformatted code. There is a Markdown cheatsheet link located above the Post button, or you can complete the Markdown Basics Course here on Treehouse.

Thank you, and I'm glad you have it figured for now.
Jason Anders ~Treehouse Community Moderator

Note: I have marked you Post as "Solved"