pythonV1V2/test.py
sairate fd2063095c chore: 添加项目基础结构和示例代码
- 创建 .idea 目录和相关配置文件,设置项目结构
- 添加多个课堂成果示例代码,涵盖不同主题和功能
- 创建和配置 .gitignore 文件,忽略特定文件和目录
2025-07-06 12:05:09 +08:00

29 lines
897 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import random
import os
import time
jiang=["特等奖","一等奖","二等奖","三等奖","安慰奖"]
dictionary = {"1 2":"特等奖","3 10":"一等奖","11 20":"二等奖","21 40":"三等奖","41 100":"安慰奖"}
print("欢迎来到抽奖系统")
while 1:
if input("是否抽奖y/n")=='y':
num=random.randint(1,100)
sleep_time=0.1
index = 0
for i in range(10):
os.system('cls')
print(f"正在抽奖{jiang[index]}")
index = (index+1) % len(jiang)
time.sleep(sleep_time)
sleep_time += 0.05
os.system('cls')
for key,value in dictionary.items():
fan=key.split(" ")
if num in [i for i in range(int(fan[0]),int(fan[1])+1)]:
print(f"恭喜您中奖了{value}")
else:
print("欢迎下次再来")
break
os.system('pause')