Python Python Basics Functions and Looping Raise an Exception

Eldin Guzin
Eldin Guzin
1,625 Points

task: raise an exception

I absolutely do not get this...I rewatched the videos but it does not make any sense to me,can someone put the answer ?
def suggest(product_idea):
    return product_idea + "inator"
if product_idea

1 Answer

Steven Parker
Steven Parker
182,590 Points

You've got the right idea about adding a test, but:

  • the test must come before the "return"
  • you need to check the length of the argument against the limit value
  • if the length doesn't meet the criteria, you'll need to "raise" an exception
  • anything that is part of a function must be indented more than the "def" line