def multiplication_or_sum(num1, num2):
# calculate product of two number
product = num1 * num2
# check if product is less then 1000
if product <= 1000:
return product
else:
# product is greater than 1000 calculate sum
return num1 + num2
# first condition
result = multiplication_or_sum(20, 30)
print("The result is", result)
I run this code. and i got syntax error constantly. I don’t know what’s wrong with this code.
New contributor
Bahare Zamani is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
3