DEV Community

loading...

Discussion on: Daily Challenge #312 - Describe the Function

Collapse
peter279k profile image
peter279k

Python:

def calc_type(a, b, res):
    if a + b == res:
        return "addition"
    if a - b == res:
        return "subtraction"
    if a * b == res:
        return "multiplication"
    if a / b == res:
        return "division"
Enter fullscreen mode Exit fullscreen mode