# def sum_numbers(*args): num = 0 print(args) # 循环遍历 for n in args: num += n return num result = sum_numbers(1,2,3,4,5) print(result)
“for n in arg”意思是依次将“arg”中的值赋给n
for x in [1, 2, 3]: print(x, end=" ")
输出结果为1 2 3
翼龙 发表于2022-09-06 18:48
好的,懂了,谢谢