开篇
来了来了,又到了准备烦人的期末python课程设计的时候了,我相信你一定是摆烂了好久了吧,哈哈哈哈!
被我猜到了吧!不过不要担心!本初学者为大家奉上一个完全应付大作业的小代码啦!
话不多说!正文就在下面!
正文
题目
运用你所学的python知识进行程序编写
**注释 **一定要下载好python嗷,别没有工具就说运行不了
代码
# 菜单列表meau_lis = [1, "牛排", 70], [2, "羊排", 80], [3, "大盘鸡", 50], [4, "火锅鸡", 90], [5, "猪大骨", 45], \ [6, "米饭", 2], [7, "寿司", 6], [8, "大饼", 4], [9, "小米粥", 2], [10, "鸡蛋汤", 2], \ [11, "土豆丝", 16], [12, "地三鲜", 25], [13, "鱼香肉丝", 24], [14, "糖醋排骨", 46], [15, "小酥肉", 40], \ [16, "咖啡", 12], [17, "牛奶", 5], [18, "西瓜汁", 6], [19, "可口可乐", 6], [20, "红酒", 299]# 购买的餐品列表dc_lis = []# 会员列表passkeylis = []# 餐桌号desk = ""# 会员注册def zhuce():print(" ****欢迎光临爱琴海餐厅!!****\n")while True:password = input("请输入会员账号: \n")key1 = input("请输入密码: \n")key2 = input("请再次输入密码: \n")if key1 == key2:passkey = [password, key1]passkeylis.append(passkey)print("注册成功!!!")print("返回首页!")breakelse:print("两次密码不一致,请重新注册!!!")continue# 输出餐桌def canzhuo():print(" ****欢迎光临爱琴海餐厅!!****\n")print("尊敬的顾客请您选座! ! \n")print("\tX-X\tX-X\tX-X\tX-X\tX-X\t")print("\t|A|\t|B|\t|C|\t|D|\t|E|\t")print("\tX-X\tX-X\tX-X\tX-X\tX-X\t")print("\n")print("\tX-X\tX-X\tX-X\tX-X\tX-X\t")print("\t|F|\t|G|\t|H|\t|I|\t|J|\t")print("\tX-X\tX-X\tX-X\tX-X\tX-X\t")print("\n")print("\tX-X\tX-X\tX-X\tX-X\tX-X\t")print("\t|K|\t|L|\t|M|\t|N|\t|O|\t")print("\tX-X\tX-X\tX-X\tX-X\tX-X\t\n")# 输出菜单def meau():print("本店特色:\t\t主食\t\t菜品\t\t\t饮品")print("1 牛排-70\t\t6 米饭-2\t\t11 土豆丝-16\t\t16 咖啡-12")print("2 羊排-80\t\t7 寿司-6\t\t12 地三鲜-25\t\t17 牛奶-5")print("3 大盘鸡-50\t\t8 大饼-4\t\t13 鱼香肉丝-24\t\t18 西瓜汁-6")print("4 火锅鸡-90\t\t9 小米粥-2\t\t14 糖醋排骨-46\t\t19 可口可乐-6")print("5 猪大骨-45\t\t10 鸡蛋汤-2\t\t15 小酥肉-40\t\t20 红酒-299\n")# 输出选购的订单def show_dc_lis():if len(dc_lis) == 0:print("您什么都没有购买o(╥﹏╥)o.")else:print("您的选购清单: ")for i in dc_lis:for j in meau_lis:if i[0] == j[0]:print(j[1]+"x "+str(i[1]))# 点餐def diancan():while True:meau()s = int(input("请输入所选的餐品数字编号: \n"))n = int(input("请输入要购买的数量: \n"))a = [s, n]dc_lis.append(a)print("是否继续点购? (y\是,n\否)")k = input()if k == "y" or k == "Y":continueelif k == "n" or k == "N":show_dc_lis()breakelse:print("输入有误,结束选购. ")show_dc_lis()break# vip积分def vip(total):print("您是否为本店会员? (y/n)")while True:k = input()if k == "y" or k == "Y":print("您可为您的账户累计消费者积分: (1元=1分)")print("请登录您的账户! ! ")while True:password = input("请输入会员账号: ")key = input("请输入密码: ")for i in passkeylis:if i[0] == password:if i[1] == key:print("恭喜您登陆成功! ")print("已成功累计消费积分:{}(1元=1分)".format(total))breakelse:print("密码不正确,请重新输入!! ")else:print("没有此账号,很遗憾本次积分作废!! ")breakbreakbreakelif k == "n" or k == "N":print("很遗憾你不能获得积分,无法享受更多优惠,期待以后您加入我们会员大家庭享受更多权益!! ")break# 购物评价def pingjia():print("请为本次购物打分:")print("非常满意: A")print("满 意: B")print("不 满 意: C")print("极不满意: D")while True:x = input()if x == "A":print("感谢您的支持,祝您生活愉快!!")breakelif x == "B":print("感谢您的宝贵意见,我们将做的更好,祝您生活愉快!!")breakelif x == "C":print("抱歉由于我们的失误让您的就餐不满意,我们将做出深刻的反思,祝您生活愉快!!")breakelif x == "D":print("我们深感抱歉,请您致电12345,我们将为您提供单独的处理以及补偿,祝您生活愉快!!")breakelse:print("输入有误,请重新评价!!")# 消费结算def jiesuan():print("商品名称\t\t单价\t\t数量\t\t总价")total = 0for i in dc_lis:for j in meau_lis:if i[0] == j[0]:print(j[1]+"\t\t\t"+str(j[2])+"\t\t\t"+str(i[1])+"\t\t\t"+str(j[2]*i[1]))total = total+(j[2]*i[1])print("共计消费: {}元".format(total))vip(total)pingjia()dc_lis.clear()# 本店就餐结算def jiucan_1():global deskcanzhuo()kk = input("请输入餐桌号: (例如: A)").upper()desk = kkwhile True:diancan()print("是否继续选购? y/n")k = input()if k == "y" or k == "Y":continueelif k == "n" or k == "N":breakprint("柜台结算: ")print(desk + "桌结算信息如下: ")jiesuan()print("\n")print("感谢您的光临! ! !")# 带回家就餐结算def jiucan_2():while True:diancan()print("是否继续选购? y/n")k = input()if k == "y" or k == "Y":continueelif k == "n" or k == "N":breakprint("柜台结算: ")print("您结算信息如下: ")jiesuan()print("\n")print("感谢您的光临! ! !")# 就餐场地结算def jiucan():print(" ****欢迎光临爱琴海餐厅!!****\n")print("请问您在店就餐或是带走就餐?")print("1.在店就餐")print("2.带回家")while True:k = input("请按序号选择: \n")if k == "1":jiucan_1()breakelif k == "2":jiucan_2()breakelse:print("输入错误,请重新输入!!")input("按任意键退回.......")# 主函数def main():while True:print(" ****欢迎光临爱琴海餐厅!!****\n")print(" 1.会员注册 ")print(" 2.进店就餐 ")print(" 3.离开")k = input("------------->>>请输入数字进行操作:")if k == "1":zhuce()elif k == "2":jiucan()elif k == "3":breakelse:print("输入有误,请重新输入! !")main()
结尾
代码比较简单,可以自己进行学习