import csv
import random
#數(shù)據(jù)讀入
f=open("name.csv","r")
flines=csv.reader(f)
name_list=[]
m=6 #班級總數(shù)
total=18 #參賽總?cè)藬?shù)
for line in flines:
name list.append(line)
flag=[False]*n
grade=[3]*m
i=0
while i<total:
p=random.randint(, )
bj=int(name_list[p][0])
if flag[p]=False:
if grade[bj-1]>0:
flag[p]=True
i+=1
print("抽取名單為:")
print(”班級","姓名")
for i in range(n):
if flag[i]:
print(name_list[i][0],name_list[i][1])
f.close()