
Blessing Nyamayedenga
6,163 Pointshey guys , please I need help I seem not to get this right im getting an EOFError
def suggest(product_idea):
return product_idea + "inator"
if len.product_idea < 3:
raise ValueError ("please enter longer name ")
try:
input("please enter your suggestion")
except ValueError as err :
print("{}" .format(err))
else:
print(product_idea)
suggest()
2 Answers

Josh Keenan
17,380 PointsTo complete the challenge this is all you need:
def suggest(product_idea):
if len(product_idea) < 3:
raise ValueError
return product_idea + "inator"
Firstly, you need to check if it is valid before you return the new string, you don't need to output anything if the product idea is less than 3 characters, only raise the exception.

Blessing Nyamayedenga
6,163 PointsThanks Josh much appreciated
Blessing Nyamayedenga
6,163 PointsBlessing Nyamayedenga
6,163 Pointsim still getting this error
Blessing Nyamayedenga
6,163 PointsBlessing Nyamayedenga
6,163 PointsTraceback (most recent call last): File "", line 32, in test_exception_raised File "", line 2, in suggest AttributeError: 'builtin_function_or_method' object has no attribute 'product_idea'
Josh Keenan
17,380 PointsJosh Keenan
17,380 PointsEven with my code? You should have just those 4 lines and nothing more
Josh Keenan
17,380 PointsJosh Keenan
17,380 Pointsapologies I misread your code, you used the len function incorrectly, it is called by using parentheses at the end, not a dot.
len(my_string)
This will get the length of the variable
my_string
Josh Keenan
17,380 PointsJosh Keenan
17,380 PointsThat code passes now