python 可变参数
def add1(*data):
sum = 0
for i in data:
sum = sum + i
return sum
print( add1(1,2,3,4,5) )
print( add1(*[1,2,3,4,5]) )
15
15
def add1(*data):
sum = 0
for i in data:
sum = sum + i
return sum
print( add1(1,2,3,4,5) )
print( add1(*[1,2,3,4,5]) )
15
15