注释掉的是每天都敲的任务,下面的是自己没事写的,特别的简单的,根据自己学的写的。
# menu = {
# '北京': {
# '海淀': {
# '五道口': {
# 'soho': {},
# '网易': {},
# 'google': {}
# },
# '中关村': {
# '爱奇艺': {},
# '汽车之家': {},
# 'youku': {},
# },
# '上地': {
# '百度': {},
# },
# },
# '昌平': {
# '沙河': {
# '老男孩': {},
# '北航': {},
# },
# '天通苑': {},
# '回龙观': {},
# },
# '朝阳': {},
# '东城': {},
# },
# '上海': {
# '闵行': {
# "人民广场": {
# '炸鸡店': {}
# }
# },
# '闸北': {
# '火车战': {
# '携程': {}
# }
# },
# '浦东': {},
# },
# '山东': {},
# }
# tag = True
# while tag:
# menu1 = menu
# for key in menu1:
# print(key)
# choicel = input('第一层:>>').strip()
#
# if choicel == 'b':
# print('到顶了,你得选择下面的:')
# continue
# if choicel == 'q':
# tag = False
# continue
# if choicel not in menu1:
# print('输错了')
# continue
#
# while tag:
# menu2 = menu1[choicel]
# for key in menu2:
# print(key)
#
# choicel = input('第二层:>>').strip()
#
# if choicel == 'b':
# break
# if choicel == 'q':
# tag = False
# continue
# if choicel not in menu2:
# print('输错了')
# continue
#
# while tag:
# menu3 = menu2[choicel]
# for key in menu3:
# print(key)
# choicel = input('第三层:>>').strip()
#
# if choicel == 'b':
# break
# if choicel == 'q':
# tag = False
# continue
# if choicel not in menu3:
# print('输错了')
# continue
#
# while tag:
# menu4 = menu3[choicel]
# for key in menu4:
# print(key)
# choicel = input('第四层:>>').strip()
# if choicel == 'q':
# tag = False
# continue
# if choicel == 'b':
# break
# if choicel not in menu4:
# print('输错了')
# continue
product_list = [['Iphone7', 5800],['Coffee', 30],['疙瘩汤', 10],['Python Book', 99],['Bike', 199],['ViVo X9', 2499],
]
name_list = []
menu_dic = {}
buy_list = []
username_pwd = [{'xxx': '12'}, {'rui': '222'}]
# pwd = '123'
count = 0
tag3 = True
tag2 = True
tag1 = True
tag = True
sum_price = 0
while tag2:print(&#39;{:-^20}&#39;.format(&#39;>登录<&#39;))print(&#39;{:-^20}&#39;.format(&#39;>注册<&#39;))print(&#39;{:-^20}&#39;.format(&#39;如果没有账号请注册&#39;))choose_login_register &#61; input("请选择你要进行的操作:>>").strip()if choose_login_register &#61;&#61; &#39;登录&#39;:while tag1:inp_username &#61; input(&#39;请输入用户名:&#39;).strip()inp_pwd &#61; input(&#39;请输入密码:&#39;).strip()if {inp_username: inp_pwd} in username_pwd:while tag:for i in product_list:x, y &#61; imenu_dic[x] &#61; yname_list.append(x)print(f&#39;商品名&#xff1a;{x}--&#xffe5;:{y}&#39;)print(f&#39;购物车里面的商品&#xff1a;{buy_list}&#39;)choose &#61; input(&#39;将你想要的添加到购物车&#xff1a;>>&#39;).strip()if choose &#61;&#61; &#39;结算&#39;:# tag &#61; Falsebreakif choose in name_list:buy_list.append(choose)else:print(&#39;请输入正确的商品名&#39;)continuefor j in buy_list:sum_price &#61; sum_price &#43; int(menu_dic[j])print(f&#39;您需要支付:&#xffe5;{sum_price}元&#39;)# zhifubao &#61; input("请输入您的支付宝账户").strip()tag1 &#61; Falsecontinueelse:if count &#61;&#61; 2:print(&#39;没次数了&#39;)breakprint(f&#39;输入错误&#xff0c;你还有{2 - count}次机会&#39;)count &#43;&#61; 1elif choose_login_register &#61;&#61; &#39;注册&#39;:while tag3:username_pwd_cop &#61; username_pwd.copy()for k in username_pwd:if len(username_pwd_cop)