使用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

点赞(0) 打赏

评论列表 共有 0 条评论

暂无评论

微信公众账号

微信扫一扫加关注

发表
评论
返回
顶部