From 2766fd1abbf9d0cee6e8acde92505756a6e1f608 Mon Sep 17 00:00:00 2001 From: BellCodeEditor <bellcode_dev@bell.ai> Date: Sun, 27 Mar 2022 17:22:23 +0800 Subject: [PATCH] save project --- 1.py | 6 ++++++ 2.py | 0 diy.py | 5 +++-- 3 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 1.py create mode 100644 2.py diff --git a/1.py b/1.py new file mode 100644 index 0000000..3fefc84 --- /dev/null +++ b/1.py @@ -0,0 +1,6 @@ +dict= {'可口可乐':3,'旺仔牛奶':4,'农夫山泉':1,'辣条':3,'巴西烤肉':2,'果冻':4,'乐事':5,'奥利奥':10,'巧克力':6} +j=input("你要买什么?") +if j in dict: + print("叮咚~您的"+j+"需要支付"+str(dict[j])+"元~") +else: + print("神奇百货暂未有你想要的物品,敬请期待~") \ No newline at end of file diff --git a/2.py b/2.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/2.py diff --git a/diy.py b/diy.py index e6e8e70..1952c76 100644 --- a/diy.py +++ b/diy.py @@ -4,8 +4,9 @@ cost= {'苹果':5.2,'山竹':12.9,'香蕉':2.4,'荔枝':15,'葡萄':9.3,'桂圆' k=input('请输入水果名称:') v=input('请输入水果价钱:') # ?补充条件判断: - if # ?: - # ?更新价钱 +if k in cost: + if int(v)<cost[k]: + cost[k]=v print(k+'降价了,现价'+v+'元') else: print(k+'涨价了,我们不买') -- libgit2 0.25.0