• 根据用户输入的月份显示对应的美食


    • 第一种方式
    month = int(input('请输入月份,我将显示对应的美食:'))
    if month == 1:
        print('在一月你可以吃:一品豆腐、葱烧海参、三丝鱼翅')
    elif month == 2:
        print('在二月你可以吃:白扒四宝、糖醋黄河鲤鱼、芫爆鱿鱼卷')
    elif month ==3:
        print('在三月你可以吃:九转大肠、油爆双脆、扒原壳鲍鱼')
    elif month == 4:
        print('在四月你可以吃:油焖大虾、醋椒鱼、糟熘鱼片、温炝鳜鱼片')
    elif month == 5:
        print('在五月你可以吃:清汤银耳、木樨肉(木须肉)、胶东四大温拌、糖醋里脊')
    elif month == 6:
        print('在六月你可以吃:红烧大虾、招远蒸丸、枣庄辣子鸡、清蒸加吉鱼、葱椒鱼')
    elif month == 7:
        print('在七月你可以吃:糖酱鸡块、油泼豆莛、诗礼银杏、奶汤蒲菜、乌鱼蛋汤')
    elif month == 8:
        print('在八月你可以吃:锅烧鸭、香酥鸡、黄鱼豆腐羹、拔丝山药、蜜汁梨球')
    elif month == 9:
        print('在九月你可以吃:砂锅散丹、布袋鸡、芙蓉鸡片、氽芙蓉黄管、阳关三叠')
    elif month == 10:
        print('在十月你可以吃:雨前虾仁、乌云托月、黄焖鸡块、锅塌黄鱼、奶汤鲫鱼')
    elif month == 11:
        print('在十一月你可以吃:烧二冬、泰山三美汤、清汤西施舌、赛螃蟹、烩两鸡丝')
    elif month == 12:
        print('在十二月你可以吃:象眼鸽蛋、云片猴头菇、油爆鱼芹、酥炸全蝎、西瓜鸡')
    else:
        print('您输错了')
    
    • 第二种方法(在上一种方法的基础上添加了对月份的判断)
    THE_MONTH_LIST = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]  # 将12个月份存放在列表中
    month = int(input('请输入月份,我将显示对应的美食:'))
    if month in THE_MONTH_LIST:  # 判断输入的月份是否在列表中
        if month == 1:
            print('在一月你可以吃:一品豆腐、葱烧海参、三丝鱼翅')
        elif month == 2:
            print('在二月你可以吃:白扒四宝、糖醋黄河鲤鱼、芫爆鱿鱼卷')
        elif month == 3:
            print('在三月你可以吃:九转大肠、油爆双脆、扒原壳鲍鱼')
        elif month == 4:
            print('在四月你可以吃:油焖大虾、醋椒鱼、糟熘鱼片、温炝鳜鱼片')
        elif month == 5:
            print('在五月你可以吃:清汤银耳、木樨肉(木须肉)、胶东四大温拌、糖醋里脊')
        elif month == 6:
            print('在六月你可以吃:红烧大虾、招远蒸丸、枣庄辣子鸡、清蒸加吉鱼、葱椒鱼')
        elif month == 7:
            print('在七月你可以吃:糖酱鸡块、油泼豆莛、诗礼银杏、奶汤蒲菜、乌鱼蛋汤')
        elif month == 8:
            print('在八月你可以吃:锅烧鸭、香酥鸡、黄鱼豆腐羹、拔丝山药、蜜汁梨球')
        elif month == 9:
            print('在九月你可以吃:砂锅散丹、布袋鸡、芙蓉鸡片、氽芙蓉黄管、阳关三叠')
        elif month == 10:
            print('在十月你可以吃:雨前虾仁、乌云托月、黄焖鸡块、锅塌黄鱼、奶汤鲫鱼')
        elif month == 11:
            print('在十一月你可以吃:烧二冬、泰山三美汤、清汤西施舌、赛螃蟹、烩两鸡丝')
        elif month == 12:
            print('在十二月你可以吃:象眼鸽蛋、云片猴头菇、油爆鱼芹、酥炸全蝎、西瓜鸡')
    else:
        print('您输入的月份有误')
    
  • 相关阅读:
    How to generate UML Diagrams from Java code in Eclipse
    Login Reference for PhotoSomething
    XML Schema and XMLspy notes
    Test Regular Expressions Online with RegExr免费的正则表达式检验网站
    孟子《生于忧患,死于安乐》日:“故天将降大任于斯人也,必先苦其心志,劳其筋骨,饿其体肤,空乏其身,行拂乱其所为,所以动心忍性,曾益其所不能。”
    Development of largescale site performance optimization method from LiveJournal background
    Navigation Bar options for Android (based on photosomething project)
    Reprint: ADB is Not Recognized as an internal or external command Fix
    Websites for more Android development information
    Computer Vision: OpenCV, Feature Tracking, and BeyondFrom <<Make Things See>> by Greg
  • 原文地址:https://www.cnblogs.com/lcfzh/p/10048925.html
Copyright © 2020-2023  润新知