Friday, March 29, 2019

Python: return multiple values from a function


def op(number1, number2):
    return number1 + number2, number1 - number2, number1 * number2, number1 / number2

add, sub, mul, div = op(10, 5)
print (add, sub, mul, div)


The result:
(15, 5, 50, 2)

No comments:

 
Get This <