#作业二:请闭眼写出购物车程序 #需求: 用户名和密码存放于文件中,格式为:egon|egon123 启动程序后,先登录,登录成功则让用户输入工资,然后打印商品列表,失败则重新登录,超过三次则退出程序 允许用户根据商品编号购买商品 用户选择商品后,检测余额是否够,够就直接扣款,不够就提醒 可随时退出,退出时,打印已购买商品和余
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
import os product_list = [['Iphone7',5800], ['Coffee',30], ['疙瘩汤',10], ['Python Book',99], ['Bike',199], ['ViVo X9',2499], ] shopping_cart={} current_userinfo=[] db_file=r'db.txt' while True: print(''' 登陆 注册 购物 ''') choice=input('>>: ').strip() if choice == '1': #1、登陆 tag=True count=0 while tag: if count == 3: print('