python 年会抽奖小程序
import random
name = ["a","b","c","d","e","f","g"] #定义抽奖列表
for i in range(3):
a = random.choice(name) #随机抽取内容
name.remove(a)
print(f"恭喜{a}抽中泰国5日游")
inn = input("是否进行下次抽奖(y/n):")
if inn == "y":
print("继续进行二等奖抽奖")
else:
exit("输入内容不正确")
for i in range(2):
b = random.choice(name)
name.remove(b)
print(f"恭喜{b}抽中phone?机")
innn = input("是否进行下次抽奖(y/n):")
if innn == "y":
print("继续进行一等奖抽奖")
else:
exit("输入内容不正确")
for i in range(1):
c = random.choice(name)
name.remove(c)
print(f"恭喜{c}抽中避孕套?盒")