【发布时间】:2026-01-06 18:25:01
【问题描述】:
我希望能够将两个整数的元组的 z 变量作为参数传递给 add 函数。为了有足够的参数正常运行,我必须在函数调用中添加什么? (Python代码)
def add(x, y):
return x + y
print(add(3, 4)) # this line works just fine
z = (3, 4)
print(add(z)) # this line will cause an error
【问题讨论】: