其他分享
首页 > 其他分享> > 呵呵额呵呵

呵呵额呵呵

作者:互联网

flag = True
print("欢迎光临阿瑞斯尚品店!")
money = input("请输入您的余额:")
while flag:
shopingcar =[]
if money.isdigit() and int(money) > 0 :
print("请查看商品列表")
else :
print("没钱乱窜啥!")
break
li = [{"CPU":"1450"},
{"SSD":"455"},
{"GPU":"400"},
{"鼠标":"45"},
{"内存":"350"},
{"键盘":"50"},
{"显示器":"150"}]
for j in li:
for k,v in j.items():
print("{s1}、 {k1}\t{v1}元".format(s1 =li.index(j)+1,k1 = k,v1 = v).expandtabs())
s = input("请输入您所需物品的序号/输入q/Q退出程序")
if s.isdigit():
s = int(s)
if s>0 and s<=len(li):
shopingcar.append(li[s - 1])
for l,l1 in shopingcar[len(shopingcar)-1].items():
print("商品{shang} 价格{jia}".format(shang = l,jia = l1))
if int(money)-int(l1)>0:

print("您的余额为:{yu}")

else:print("请输入有效的商品序号!")
elif s.upper() == "Q":break
else:print("请输入商品的序号!")

标签:呵呵,money,li,int,l1,print,shopingcar
来源: https://www.cnblogs.com/aries-zhang/p/10339296.html