Python日常3

今天没什么好写的:

list = [1, 2, 3, 4]#全局变量
def sum(*args):#可变参数
    result = 0
    for temp in list:
        result += temp
    return result
    
print('%d'%sum(list))#结果为10

猜你喜欢

转载自www.cnblogs.com/lonelyWMW/p/9388091.html
今日推荐