使用while 进行循环,进行三轮之后,停止。random.sample() 抽样不重复查询数据
import random
name_list = []
for i in range(0,100):
name_list .append('员工{i}')
winnerNum = [30,6,3] //每个中奖人数
count = 0
while count < 3:
choice = input(f'开始抽{3-count}奖...:')
winners = random.sample(name_list ,lottery_levels[count])
print(winners)
for p in winners:
name_list.remove(p) #删除已中奖者
count += 1