Python ❀ 使用代码解决今天中午吃什么的重大生存问题

1. 环境安装

安装Python代码环境参考文档

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 任意一个数字!!!")
相关推荐
Eric.Lee202111 分钟前
python opencv 将不同shape尺寸的图片制作video视频
python·opencv·音视频
Amo Xiang22 分钟前
Python 常用模块(八):logging模块
python·logging·日志
森哥的歌24 分钟前
Python多线程
python·编程·多线程·并发·threading
抽风的雨6101 小时前
【python基础知识】Day26 函数
开发语言·python
编程有点难1 小时前
Python训练打卡Day22
开发语言·python·机器学习
天机️灵韵2 小时前
字节开源FlowGram与n8n 技术选型
人工智能·python·开源项目
兮兮能吃能睡2 小时前
Python之with语句
数据库·python
boooo_hhh2 小时前
第28周——InceptionV1实现猴痘识别
python·深度学习·机器学习
咕噜咕噜啦啦2 小时前
Python爬虫入门
开发语言·爬虫·python
dubochao_xinxi2 小时前
✅ TensorRT Python 安装精简流程(适用于 Ubuntu 20.04+)
开发语言·python·ubuntu