python如何输入十个学生的成绩
导读
python输入十个学生成绩的方法:
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)
评论(0)
导读
python输入十个学生成绩的方法:
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)