为什么计算出来的答案只有整数部分2呢?
def average(*args): sum = 0 if len(args) == 0: return sum for item in args: sum += item avg = sum / len(args) return avg print(average(1,2,3,4))
def average(*args): sum = 0 if len(args) == 0: return sum for item in args: sum += item avg = sum / len(args) return avg print(average(1,2,3,4))
2024-04-26
举报