主页
Python
Python *args 和 **kwargs
demo_function_args_sum
运行 ❯
×
更改方向
保存代码
更改主题
def my_function(*numbers): total = 0 for num in numbers: total += num return total print(my_function(1, 2, 3)) print(my_function(10, 20, 30, 40)) print(my_function(5))
6
100
5