Python Python Basics Functions and Looping Raise an Exception

Raise an Exception Question (Syntax Error)

I keep getting an error which says "IndentationError: unindent does not match any outer indentation level" for line 5.

suggestinator.py
def suggest(product_idea):
    if product_idea < 3:
        raise ValueError ("Didn't Work")
    return product_idea + "inator"
 except ValueError as err:
        print("{}".format(err))

2 Answers

KRIS NIKOLAISEN
PRO
KRIS NIKOLAISEN
Pro Student 51,912 Points

It looks like except is somewhere before your first indentation level if product_idea < 3: Outside of this if you are going to use except I believe you need a try clause. And those should come before the return statement. But all of that isn't necessary to complete the challenge. You can remove lines 5 and 6.

Then you just need to make sure you are comparing the length of product_idea to 3.

Thank you for taking the time to answer,I solved it .