1. 环境安装
2. 代码块
python
import random
# 准备一下你想吃的东西
hot = ["兰州拉面", "爆肚面", "黄焖鸡", "麻辣香锅", "米线", "麻食", "羊肉泡馍", "肚丝/羊血汤", "米饭快餐", "大盘鸡盖面", "酸菜鱼", "油泼面", "饺子", "砂锅"]
cold = ["凉皮和肉夹馍", "凉面"]
# 选项
weather = input("想吃什么就选择对应的数字吧\n1. 想吃冷的;\n2. 想吃热的;\n3. 冷热都要吃!\n你的选择是?: ---> ")
if weather.isdigit():
if weather == 1:
for i in random.choices(cold):
print("今天中午吃:{}".format(i))
elif weather == 2:
for i in random.choices(hot):
print("今天中午吃:{}".format(i))
else:
food = hot + cold
for i in random.choices(food):
print("今天中午吃:{}".format(i))
else:
print("选错了,只能选 1/2/3 任意一个数字!!!")