博客
关于我
12 购物车之一(用列表)
阅读量:798 次
发布时间:2023-04-16

本文共 546 字,大约阅读时间需要 1 分钟。

asset_all = eval(input("请输入总资产:"))car_list = []goods = [    {"name":"电脑","price": 1999},    {"name":"鼠标","price": 10},    {"name":"游艇","price": 20},    {"name":"美女","price": 998},]for i in goods:    print(f"{i['name']},{i['price']}")while True:    i2 = input("请输入商品(y/Y进行结算):")    if i2.lower() == 'y':        break    for j in goods:        if j['name'] == i2:            car_list.append(j)print(car_list)sum = 0for item in car_list:    p = item['price']    sum += pprint(asset_all, sum)if asset_all < sum:    print("余额不足")else:    print("购买成功")

转载地址:http://asgfk.baihongyu.com/

你可能感兴趣的文章
MySQL-Buffer的应用
查看>>
mysql-cluster 安装篇(1)---简介
查看>>
mysql-connector-java.jar乱码,最新版mysql-connector-java-8.0.15.jar,如何愉快的进行JDBC操作...
查看>>
mysql-connector-java各种版本下载地址
查看>>
mysql-EXPLAIN
查看>>
MySQL-Explain的详解
查看>>
mysql-group_concat
查看>>
MySQL-redo日志
查看>>
MySQL-【1】配置
查看>>
MySQL-【4】基本操作
查看>>
Mysql-丢失更新
查看>>
Mysql-事务阻塞
查看>>
Mysql-存储引擎
查看>>
mysql-开启慢查询&所有操作记录日志
查看>>
MySQL-数据目录
查看>>
MySQL-数据页的结构
查看>>
MySQL-架构篇
查看>>
MySQL-索引的分类(聚簇索引、二级索引、联合索引)
查看>>
Mysql-触发器及创建触发器失败原因
查看>>
MySQL-连接
查看>>