from random import randint
from time import clock
math = [randint(60,100) for _ in range(20)] # 推导表达式 + 随机数生成列表
english = [randint(60,100) for _ in range(20)]
chinese = [randint(60,100) for _ in range(20)]
# 计算每个学生成绩总分
scores = []
start = clock()
for i in range(len(math)):
scores.append(math[i] + english[i] + chinese[i])
end = clock()
print(end - start) # 3.0324292650884347e-05
print(scores)
c1 = [randint(150,300) for _ in range(40)] # 推导表达式 + 随机数生成列表
c2 = [randint(150,300) for _ in range(43)]
c3 = [randint(150,300) for _ in range(48)]
# 计算每班成绩超过250的数量
count = 0
start1 = clock()
for i in c1:
if i >= 250:
count +=1
for i in c2:
if i >= 250:
count +=1
for i in c3:
if i >= 250:
count +=1
end1 = clock()
print(end1 - start1) # 1.3529299798087369e-0