#coding utf-8from random import randint
from itertools import chain
# Demo1: get the total scores of each student; score stored in 3 lists(math,chinese,english)
stu_count =50
math =[randint(60,100)for x inrange(stu_count)]
chinese =[randint(60,100)for x inrange(stu_count)]
english =[randint(60,100)for x inrange(stu_count)]for m, c, e inzip(math, chinese, english):print(m + c + e)# Demo2: here are 3 lists of students' english scores(en1, en2, en3)# you need to get the count of score bigger than 90
en1 =[randint(60,100)for x inrange(38)]
en2 =[randint(60,100)for x inrange(40)]
en3 =[randint(60,100)for x inrange(41)]
count =0for x in chain(en1, en2, en3):if x >90:
count +=1print(count)
文章评论