Given two integer numbers, return their product only
if the product is equal to or lower than 1000, else return their sum.
Def multiplication_or_sum(num1, num2):
product = num1 * num2
if product < = 1000:
return product
else:
return num1 + num2
result = multiplication_or_sum(20,30)
print("The result is = ", result)
result = multiplication_or_sum(50,10)
print("The result is = ", result)
my output
The result is = 600
The result is = 500
expected output
The result is = 600
The result is = 60
but Can’t figure out the error
>Solution :
if the product is equal to or lower than 1000, else return their sum.
if x*y <= 1000:
return x*y
else:
return x+y
20 * 30 = 600
600 < 1000
return 600
50 * 10 = 500
500 < 1000
return 500