标签:and word 查看 else 用户名 show command input login
import sys menu = ‘‘‘ 1)店铺信息 2)派送员信息 3)客服人员信息 4)订单信息 5)配送信息 ‘‘‘ # print(menu). class Shop(object): ‘‘‘ 店铺信息 ‘‘‘ def __init__(self): self.shop_info = {‘肯德基‘: {‘菜品‘: [‘全家桶‘, ‘炸鸡‘, ‘鸡肉卷‘]}, ‘金桥美食广场‘: {‘菜品‘: [‘麻辣烫‘, ‘麻辣香锅‘, ‘烤肉拌饭‘]}} # 查看店铺 def show(self): print(self.shop_info) # 添加店铺 def add(self): self.add_name = input(‘请添加店铺名称:‘) self.food = input(‘请添加菜品名称:‘) self.shop_info[self.add_name] = {‘菜品‘: [self.food]} # 删除店铺 def delete(self): self.del_name = input(‘请输入你要删除的店铺:‘) self.shop_info.pop(self.del_name) print(‘已开除:{}‘.format(self.del_name)) class Courier(object): ‘‘‘ 派送员信息 ‘‘‘ def __init__(self): self.courier_info = {‘外卖一号‘: {‘性别‘: ‘男‘, ‘电话‘: 123456789}, ‘外卖二号‘: {‘性别‘: ‘男‘, ‘电话‘: 123123123}, } # 查看店铺 def show(self): print(self.courier_info) # 添加员工 def add(self): self.add_name = input(‘请输入外卖员名称:‘) self.gender = input(‘请选择性别(男or女):‘) self.tel = input(‘请输入电话号码:‘) self.courier_info[self.add_name] = {‘性别‘: self.add_name, ‘电话‘: self.tel} print(self.courier_info) # 员工离职 def delete(self): self.del_name = input(‘请输入你要删除的员工姓名:‘) self.courier_info.pop(self.del_name) print(‘已删除{}‘.format(self.del_name)) class Staff(object): ‘‘‘ 客服信息 ‘‘‘ def __init__(self): self.staff_info = {‘客服一号‘: {‘年龄‘: ‘18‘, ‘性别‘: ‘女‘}, ‘客服二号‘: {‘年龄‘: ‘22‘, ‘性别‘: ‘女‘} } # 查看客服 def show(self): print(self.staff_info) # 添加客服 def add(self): self.add_name = input(‘请输入客服姓名:‘) self.gender = input(‘请选择性别(男or女):‘) self.age = input(‘请输入年龄:‘) self.staff_info[self.add_name] = {‘年龄‘: self.age, ‘性别‘: self.gender} # 删除客服 def delete(self): self.del_name = input(‘请输入你要开除的客服:‘) self.staff_info.pop(self.del_name) print(‘已开除:{}‘.format(self.del_name)) class Order(object): ‘‘‘ 订单信息 ‘‘‘ def __init__(self): self.order_info = {‘订单1‘: {‘餐品名称‘: ‘麻辣烫拌饭‘, ‘配送员‘: ‘外卖一号‘, ‘地址‘: ‘丽景花园‘, ‘联系电话‘: ‘123‘, ‘备注‘: ‘不加麻,不加辣!‘}} # 查看订单 def show(self): print(self.order_info) # 添加订单 def add(self): self.add_name = input(‘请输入订单编号:‘) self.c_name = input(‘请输入外卖员名称:‘) self.food_name = input(‘请输入餐品名称:‘) self.address = input(‘请输入收货地址:‘) self.tel = input(‘请输入联系电话号码:‘) self.remarks = input(‘请输入备注信息:‘) self.order_info[self.add_name] = {‘餐品名称‘: self.food_name, ‘配送员‘: self.c_name, ‘地址‘: self.address, ‘电话‘: self.tel, ‘备注‘: self.remarks} print(self.order_info) # 删除订单 def delete(self): self.del_name = input(‘请输入你要删除订单:‘) self.order_info.pop(self.del_name) print(‘已删除{}‘.format(self.del_name)) def edit(self): self.edit_name = input(‘请输入你要修改的订单:‘) if self.order_info.get(self.edit_name): self.c_name = input(‘请输入外卖员名称:‘) self.food_name = input(‘请输入餐品名称:‘) self.address = input(‘请输入收货地址:‘) self.tel = input(‘请输入联系电话号码:‘) self.remarks = input(‘请输入备注信息:‘) self.order_info[self.edit_name] = {‘餐品名称‘: self.food_name, ‘配送员‘: self.c_name, ‘地址‘: self.address, ‘电话‘: self.tel, ‘备注‘: self.remarks} else: print(‘订单不存在‘) class Delivery(object): ‘‘‘ 配送信息 ‘‘‘ def __init__(self): self.delivery_info = {‘配送订单001‘: {‘外卖员‘: ‘外卖一号‘, ‘地址‘: ‘丽景花园‘}} # 查看配送信息 def show(self): print(self.delivery_info) # 添加配送信息 def add(self): self.delivery_name = input(‘请输入订单:‘) self.c_name = input(‘请输入外卖员姓名:‘) self.address = input(‘请输入地址:‘) self.delivery_info[self.delivery_name] = {‘外卖员‘: self.c_name, ‘地址‘: self.address} # 删除配送信息 def delete(self): self.del_name = input(‘请输入你要删除的订单:‘) if self.delivery_info.get(self.del_name): self.delivery_info.pop(self.del_name) print(‘已删除:{}配送信息‘.format(self.del_name)) else: print(‘没用此订单!‘) s = Shop() c = Courier() s2 = Staff() o = Order() d = Delivery() def login(): username = ‘hmbc‘ password = ‘123‘ while 1: uname = input(‘请输入用户名:‘) pwd = input(‘请输入密码:‘) if username == uname and password == pwd: print(‘<<<<<<---欢迎用户{}登录外卖管理系统--->>>>>>‘.format(uname)) while 1: print(menu) command = int(input(‘请输入指令:‘)) if command == 1: # print(‘店铺详细信息:{}‘.format(s.shop_info)) command2 = input(‘你可以执行以下操作:1.查看店铺信息 2.添加店铺信息 3.删除店铺 4.返回>>>根据提示输入:‘) if command2 == ‘1‘: s.show() elif command2 == ‘2‘: s.add() print(‘添加成功!‘) print(s.shop_info) elif command2 == ‘3‘: s.delete() elif command2 == ‘4‘: continue else: print(‘输入有误!‘) sys.exit() elif command == 2: # print(‘外卖员详细信息:{}‘.format(c.courier_info)) command3 = input(‘你可以执行以下操作:1.查看人员信息 2.添加员工 3.开除员工 4.返回>>>根据提示输入:‘) if command3 == ‘1‘: c.show() elif command3 == ‘2‘: c.add() elif command3 == ‘3‘: c.delete() elif command3 == ‘4‘: continue else: print(‘输入有误!‘) sys.exit() elif command == 3: command3 = input(‘你可以执行以下操作:1.查看客服信息 2.添加客服 3.开除客服 4.返回>>>根据提示输入:‘) if command3 == ‘1‘: s2.show() elif command3 == ‘2‘: s2.add() elif command3 == ‘3‘: s2.delete() elif command3 == ‘4‘: continue else: print(‘输入有误!‘) sys.exit() elif command == 4: # print(‘客服详细信息:{}‘.format(s2.staff_info)) command3 = input(‘你可以执行以下操作:1.查看订单信息 2.添加订单 3.删除订单 4.修改订单 5.返回>>>根据提示输入:‘) if command3 == ‘1‘: o.show() elif command3 == ‘2‘: o.add() elif command3 == ‘3‘: o.delete() elif command3 == ‘4‘: o.edit() elif command3 == ‘5‘: continue else: print(‘输入有误!‘) sys.exit() elif command == 5: command3 = input(‘你可以执行以下操作:1.查看配送信息 2.添加配送信息 3.删除配送信息 4.返回>>>根据提示输入:‘) if command3 == ‘1‘: d.show() elif command3 == ‘2‘: d.add() elif command3 == ‘3‘: d.delete() elif command3 == ‘4‘: continue else: print(‘输入有误!‘) sys.exit() else: login = input(‘用户名密码错误!输入Y重新输入,输入N退出程序!‘).upper() if login == ‘N‘: sys.exit() elif login == ‘Y‘: continue else: print(‘输入错误,退出程序!‘) sys.exit() if __name__ == ‘__main__‘: login()
标签:and word 查看 else 用户名 show command input login
原文地址:https://www.cnblogs.com/hmbc/p/11785224.html