有无懂程序1或2的 包括开始界面

 

import datetime
# 正常菜单
menu1 = [
    ('热辣香骨鸡排', 11),
    ('十块香辣鸡翅', 45),
    ('十块新奥尔良鸡翅', 49),
    ('藤椒肯大大鸡排', 12),
    ('可乐', 8),
    ('雪碧', 8),
]
# 套餐菜单
menu2 = [
    ('奥尔良堡香骨鸡套餐', 35),
    ('嫩牛五方辣翅餐盒', 38),
    ('老北京卷香骨鸡翅餐盒', 36),
    ('奥尔良卷荔枝汽水餐盒', 34),
]
menu = []
shopping = []
global total_price
total_price = 0
def test():
    global total_price
    for i, v in enumerate(menu, 1):
        print(i, '---', v)

    while True:
        y = input("请选择餐品【b--退出】:")
        if y.isdigit():
            y = int(y)
            if y >= 1 and y <= len(menu):
                total_price += menu[y - 1][1]
                shopping.append(menu[y-1][0])
                break
            else:
                print("请选择显示范围内的数字!")
                continue
        elif y == 'b':
            break
        else:
            print("请选择显示范围内的数字!")
            continue
print("-------欢迎来到肯德基-------")
f = open('1.txt', 'w', encoding='utf-8')
while True:
    x = input("请选择菜单【1--单点 2--套餐】【b--退出】:")
    if x.isdigit():
        x = int(x)
        if x == 1:
            menu = menu1
            test()
        elif x == 2:
            menu = menu2
            test()
        else:
            print("请输入1或2!")
            continue
    elif x == 'b':
        if total_price >= 100:
            total_price -= 20
            f.write("您购买了:\n")
            for i in shopping:
                f.write(i+'\n')
            f.write("恭喜您获得本店满100元减20元优惠券\n")
            f.write("您目前共消费【%s元】\n" % total_price)
            day = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
            f.write(day+'\n')
            f.write("欢迎下次光临!")
            f.close()
        else:
            f.write("您购买了:\n")

            for i in shopping:
                f.write(i+'\n')
            f.write("您目前共消费【%s元】\n" % total_price)
            day = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
            f.write(day+'\n')
            f.write("欢迎下次光临!")
            f.close()
        break
    else:
        print("请输入1或2!")
        continue

如果对你有帮助,可以点击我这个回答右上方的【采纳】按钮,给我个采纳吗,谢谢