Python-4, write a function multi() with no limit on the number of parameters and return the product of all parameters

code show as below:

def multi(*n):
    s = 1
    for i in n:
        s *= i
    return s
s = multi(2, 3)
print("参数的乘积:%d" % s)

The effect is as follows:

 

おすすめ

転載: blog.csdn.net/nikezhenhaokan/article/details/130142757