用python写一段14个人不重复多次抽签的代码
时间: 2023-05-30 17:07:24 浏览: 112
import random
names = ['Alice', 'Bob', 'Charlie', 'David', 'Emma', 'Frank', 'Grace', 'Henry', 'Isabel', 'John', 'Kate', 'Liam', 'Mary', 'Nancy']
drawn = []
for i in range(14):
candidate = random.choice(names)
while candidate in drawn:
candidate = random.choice(names)
drawn.append(candidate)
print("The winner of draw", i+1, "is:", candidate)
阅读全文