Python Python Basics Functions and Looping Raise an Exception

solution for suggestinator exercise

suggestinator.py
def suggest(product_idea):
    return product_idea + "inator"
product_idea = input("Product idea please ")

if len(product_idea) < 3:
    raise valueError("Product idea is invalid")

Cant get this to work any suggestions, please?

1 Answer

The challenge wants you to raise an exception if the product_idea argument is less than three characters long. You got it right, sorta..., take a look at the code below.

def suggest(product_idea):  👈#input parameter already provided (product_idea)
    return product_idea + "inator"
product_idea = input("Product idea please ")  👈#You don't need an input for product_idea, the FRIST line of code
                                                #already handles the input, thier is an input parameter provided already

if len(product_idea) < 3:  👈# This is correct but should be inside of a function, hint(def suggest)
    raise valueError("Product idea is invalid")  👈# This is correct but should be inside of a function, hint(def suggest)

Try to make these changes, if the problem persists post back here.