代码如下
list=[7,3,4,6]
def avg(list):
sum = 0
for i in list:
sum += i
avg = sum / len(list)
return avg
print(avg(list))
结果如下
5.0
代码如下
list=[7,3,4,6]
def avg(list):
sum = 0
for i in list:
sum += i
avg = sum / len(list)
return avg
print(avg(list))
结果如下
5.0