Answers for "python oop kwargs tutorial"

3

variable number of arguments to python class

def multiply(*args):
    z = 1
    for num in args:
        z *= num
    print(z)

multiply(4, 5)
multiply(10, 9)
multiply(2, 3, 4)
multiply(3, 5, 10, 6)
Posted by: Guest on July-18-2020

Python Answers by Framework

Browse Popular Code Answers by Language