#Author:Wuyc
goods = (["苹果笔记本电脑",4200,4200111],
["华为手机",2199],
["字领露肩蓝色蕾丝",388.00],
["Bettychow女装",328.00],
["HP 笔记本",3900],
["F七匹狼夹克外套",459.00 ],)
'''
for name,money in enumerate(goods):
print(name,money);#把下标取出来
'''
BuyGoods = [];
i = 0
for item in goods:
i = i + 1
print(str(i) + ":" , item[0],item[1])
salary = int(input("工资:"));
print("输入 T 退出 !")
print("输入 P 打印商品!")
while True:
input1 = input("商品编号:");
if (input1 == "T"):
print("--------Goods List-------")
for item in BuyGoods:
print(item)
# break;
exit()
elif (input1 == "P"):
for item in BuyGoods:
print(item)
if input1.isdigit():
good_num = int(input1)
if good_num > len(goods):
print("没有这个商品")
else:
good_money = goods[good_num-1][1]
if salary >= good_money:
BuyGoods.append(goods[good_num-1])
salary = salary - good_money
print("买了个 {goodname},花了 {goodmoney}是,余额为: 33[31;1m{YE} 33[0m 元".format(goodname=goods[good_num-1][0],goodmoney=goods[good_num-1][1],YE=salary))
else:
print("