这章好难理解
求平均值代码如下: def average(*args): sum = 0.0 if def average(*args): sum = 0.0 if len(args) == 0: return sum for x in args: sum = sum + x return sum / len(args) print average() print average(1, 2) print average(1, 2, 2, 3, 4) == 0: return sum for x in args: sum = sum + x return sum / len(args) print average() print average(1, 2) print average(1, 2, 2, 3, 4)
#请问 “len(args)”是什么意思?为什么是这个?