python基础-作业七(闭包,函数)

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_27695659/article/details/84862294

2、写函数,接收n个数字,求这些参数数字的和。
def sum_func(*args):
total = 0
for i in args:
total += i
return total
print(sum_func(1,2,3,8,23,6))

3、读代码,回答:代码中,打印出来的值a,b,c分别是什么?为什么?
a=10
b=20
def test5(a,b):
print(a,b)
c = test5(b,a)
print©

4、读代码,回答:代码中,打印出来的值a,b,c分别是什么?为什么?
a=10
b=20
def test5(a,b):
a=3
b=5
print(a,b)
c = test5(b,a)
print©

猜你喜欢

转载自blog.csdn.net/qq_27695659/article/details/84862294