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)