这样也可以
d = { 'Adam': 95, 'Lisa': 85, 'Bart': 59, 'Paul': 74 }
sum = 0.0
for x in d:
sum = sum + d[x]
print sum/float(len(d))
d = { 'Adam': 95, 'Lisa': 85, 'Bart': 59, 'Paul': 74 }
sum = 0.0
for x in d:
sum = sum + d[x]
print sum/float(len(d))
2015-05-04
举报