相关截图:
相
L = [75, 92, 59, 68, 99] sum = 0 counter = 0 for x in L: counter += 1 sum += x avg = sum/counter print(avg)
L = [75,92,59,68,99]
he =0
for ch in L:
he=ch+he
print(he)
print(he/5)
for外面定义个sum,for里面,item加到sum里,for后面sum除以数组长度