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

27 lines
697 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
# 诗句列表
poems = [
"白日依山尽,黄河入海流。",
"采菊东篱下,悠然见南山。",
"山重水复疑无路,柳暗花明又一村。",
"天生我材必有用,千金散尽还复来。",
# 可以继续添加更多诗句
]
# 随机选择一个诗句
poem = random.choice(poems)
# 将诗句按逗号分割成前后两部分
part = poem.split('')
# 随机决定是替换前半句还是后半句
if random.choice([True, False]):
question = "__________" + part[1] # 替换前半句
else:
question = part[0] + "__________" # 替换后半句
# 生成题目并打印出来
print(question)