main.py
import testwhile True:test.kdc_menu()ch = int(input("请选择>>"))match ch:case 1:test.show_menu()case 2:test.sale_menu()case 3:test.money_menu()case 4:test.mess_menu()case -1:breakcase _:print("请重新输入")
test.py
menu = {1:['炸鸡',8],2:['汉堡',10],3:['薯条',5],4:['可乐',3]}
select = []
message = []
def kdc_menu():print("*"*60)print("*"*23+"欢迎来到空岛汉堡店"+"*"*23)print("\t1.查看菜单")print("\t2.点餐")print("\t3.自动结账")print("\t4.欢迎留言")
def show_menu():for i in menu.values():print(f"菜品:{i[0]},价格:{i[1]:.2f}")def sale_menu():for i, j in menu.items():print(f"{i},{j[0]},{j[1]}")while True:s = int(input("请输入菜品的序号,-1则退出选择"))if s == -1:breakelse:select.append(menu[s])print('您选择的菜品是:')for i in select:print(i[0])print('请稍等,正在准备菜品')def money_menu():t = 0print('您选择的菜品是:')for i in select: # 打印所选菜品print(i)t += i[1]print(f'消费了{t}元')while True:pay = int(input('请付款')) # 支付金额if pay >= t: # 支付金额大于菜钱print(f'找零:{pay - t}元',)breakelse:print('钱不够!')def mess_menu():m = input('请您留下富贵的意见')message.append(m)y = input('按1则可以查看所有评论')if y == '1':for i in message:print(i)