برنامج ياخذ رقمين صحيحين ويقوم بإرجاع ضربهم وإذا كان ضربهم أكبر من 1000 يرجع مجموعهم
- برمجة
- برمجة بايثون
- 2021-04-12
- osamaelsamadony
الأجوبة
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)
# Second condition
result = multiplication_or_sum(40, 30)
print("The result is", result)أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال