salary = input('please input your monthly salary: ')goods_list = [ ('iphone', 5000), ('mac pro', 12000), ('TV', 4500), ('pencel', 25)]shopping_list = []if salary.isdigit(): salary = int(salary) while True: for index, item in enumerate(goods_list): print('商品编号:%d, 商品名称:%s, 商品价格:%d' % (index, item[0], item[1])) choice = input('请选择你要的商品:>>') if choice.isdigit(): choice = int(choice) if choice < len(goods_list) and choice >= 0: choice_good = goods_list[choice] if choice_good[1] <= salary: shopping_list.append(goods_list[choice]) salary = salary - choice_good[1] print('你还有余额: %d' % salary) else: print('你的余额仅有:%d啦,不够购买此商品'%salary) else: print('没有%d的商品编码' % choice) elif choice == 'q': print('-----------SHOPPING LIST----------') for i in shopping_list: print(i) print('你还有余额: %d' % salary) exit() else: print("请输入商品编号")else: print('请输入工资金额')