#以下函数允许计算两个数的乘积,请稍加改造,变成可接收一个或多个数并计算乘积: def product(*args): if len(args) == 0: raise ValueError("请输入至少一个数字") else: a = 1 for i in args: i*=a a = i return i print(product(100,100,100))执行结果:
1000000
Process finished with exit code 0
原文地址:https://www.cnblogs.com/leigang/p/8747485.html
时间: 2024-10-08 03:46:49