#题目:
答案:
products = [["iphone", 6888], ["MacPro", 14800], ["小米6", 2499], ["Coffee", 31], ["Book", 60], ["Nike", 699]]
print("-" * 5, "\t", "商品列表", "-" * 5)
a = 0
for item in products:
print(a,end="\t")
print(products[a][0],end="\t")
print(products[a][1],end="\n")
a += 1
purchaselist = []
while 1:
s = input("请问还想购买什么?")
if s != "q" and -1 < int(s) < 6:
purchaselist.append(products[int(s)])
elif s == "q":
print("-" * 5, "\t", "想要商品列表", "-" * 5)
c = 0
for things in purchaselist:
print(c, end="\t")
print(purchaselist[c][0], end="\t")
print(purchaselist[c][1], end="\n")
c += 1
break
else:
print("你输入的商品不存在")