python3生成10个成绩列表,求其平均分

import random
alist = [random.randint(45,101) for _ in range(10)] #在[45.101)之间生成10个随机数
print(alist)
sum = 0
for i in alist:
    sum = sum + i
ave = sum / len(alist)
print(ave)

 

posted @ 2018-05-12 11:00  heheheda  阅读(14520)  评论(0编辑  收藏  举报