首页 > 代码库 > 标题我也不知道写啥
标题我也不知道写啥
1 li = ["手机","电脑","鼠标垫","游艇"]
2 for i,j in enumerate(li):
3 print(i+1,j)
4 num= input("num:")
5 num = int(num)
6 len_li = len(li)
7 if num >0 and num < len_li:
8
9 good = li[num-1]
10 print(good)
11 else:
12 print("商品不存在")
--------------分割线-----------------
1 asset_all = 1999
2 car_list = []
3
4
5 i1 = input(‘请输入总资产:‘)
6 asset_all = int(i1)
7
8 goods = [
9 {"name":"电脑","price":1999},
10 {"name":"鼠标","price":10},
11 {"name":"游艇","price":20},
12 {"name":"美女","price":998},
13 ]
14
15 for i in goods:
16 print(i[‘name‘],i[‘price‘])
17
18 while True:
19 i2 = input(‘请输入商品:‘)
20 if i2 == "y":
21 break
22 for j in goods:
23 if j [‘name‘] == i2:
24 car_list.append(j)
25
26 print(car_list)
27 all_price = 0
28 for item in car_list:
29 p = item[‘price‘]
30 all_price = all_price + p
31 print(asset_all,all_price)
32 if all_price > asset_all:
33 print(‘你个穷逼‘)
34 else:
35 print("购买成功")
标题我也不知道写啥
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。