Python Python Basics Functions and Looping Raise an Exception

dan mirea
dan mirea
2,165 Points

Im a little stuck here

Can anyone help me please?

suggestinator.py
def suggest(product_idea):
    return product_idea + "inator"

a = len(product_idea)
Daniel Svens
Daniel Svens
6,030 Points

You should modify the function instead,

def suggest(product_idea):

    ... Write code here

    return product_idea + "inator"

Something like. if length of "product_idea" is less than 3 then raise a ValueError. hope it helps :)

1 Answer

Christian Beckett
Christian Beckett
11,118 Points

In this subject you should be trying to raise a Value error my friend.

def suggest(product_idea): 
      return product_idea = "inator" 
       if len(product_idea) < 3:
         raise ValueError("The idea you have should be longer then 3 letters") 

I hope this helps you figure out the code