jiage = {}
caojiaoyue = [
{"name": "奥迪", "price": 10000},
{"name": "摩托车", "price": 1000},
{"name": "自行车", "price": 100},
{"name": "玩具车", "price": 10},
]
for a in caojiaoyue:
print(a["name"],a["price"])
zc = int(input("请输入资产:"))
while True:
sp = input("请输入商品/按Y结算:")
if sp == "y" or sp == "Y":
break
for i in caojiaoyue:
if sp == i["name"]:
if sp in jiage.keys():
jiage[sp]["数量"] = jiage[sp]["数量"] +1
else:
jiage[sp] = {"商品":i["name"],"价格":i["price"],"数量":1}
else:
print("商品错误")
break
zongjia = 0
print(jiage)
for i in jiage.values():
zongjia = i["价格"] * i["数量"] + zongjia
if zc >= zongjia:
print("购买成功")
else:
print("穷逼","资产部足")
免责声明:
① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。
② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341