Q:

Write a Python program to sum of two given integers. if the sum is between 15 to 20 it will return 20

0

Write a Python program to sum of two given integers. if the sum is between 15 to 20 it will return 20

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

I have used python 3.7 compiler for debugging purpose.

def sum(x, y):
    sum = x + y
    if sum in range(15, 20):
        return 20
    else:
        return sum
 
print(sum(10, 6))
print(sum(10, 2))
print(sum(10, 12))

Result:

20

12

22

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now