
CESAR AGUILAR
Python Development Techdegree Student 710 Pointsi need help close to sloving the raising of a ValueError but i dont know what indentation error im doing wrong?
def suggest(product_idea):
return product_idea + 'inator'
raise a ValueError(Are you sure you don't understand? )
understand = input("Do you understand ")
if understand != yes:
raise a ValueError(Are you sure you don't get it? )
return product_idea + 'inator'
2 Answers

imo
7,891 Points## There are actually several things that are wrong with your code
def suggest(product_idea):
# Your code will never go beyond this line because once the code reaches return it
# just stop there and return whatever is passed to it
# for this example, the code will execute return product_idea + 'inator' and stop
# it will not go beyond that point
return product_idea + 'inator'
# when you raise any error, you do it this way,
# raise ValueError
# raise SyntaxError
# etc
# the way you did it, "raise a ValueError" is wrong syntax
# there is no need there to be 'a', it should be just raise ValueError
# also you need to surround your question with "" quotes
# like this, raise a ValueError("Are you sure you don't understand? ")
raise a ValueError(Are you sure you don't understand? )
# the following line is not properly intended
understand = input("Do you understand ")
# yes is not surrounded by quotes, "yes"
if understand != yes:
# no quotes around question, also no need to raise ValueError here
raise a ValueError(Are you sure you don't get it? )
return product_idea + 'inator'
# This is what you need to complete the challenge
def suggest(product_idea):
# Here we check to see if the string product_idea has less then 3 characters
# if it does, we just raise the ValueError and the program stops there, it does not go to the return
# if the if statement is false, it then returns the product_idea + "inator"
if len(product_idea) < 3:
raise ValueError
return product_idea + "inator"

m3shack
Python Development Techdegree Student 279 PointsBe sure to use quotes when you type out your strings.
def suggest(product_idea):
return product_idea + 'inator'
raise a ValueError(Are you sure you don't understand? ) # < --- missing quotes here
understand = input("Do you understand ")
if understand != yes:
raise a ValueError(Are you sure you don't get it? ) # < --- missing quotes here
return product_idea + 'inator'