From 32271ea1f6005c5b5815aaaf2eacd4e52a0e2f8e Mon Sep 17 00:00:00 2001 From: BellCodeEditor <bellcode_dev@bell.ai> Date: Sat, 26 Mar 2022 20:28:30 +0800 Subject: [PATCH] auto save --- diy.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/diy.py b/diy.py index e6e8e70..86dd92e 100644 --- a/diy.py +++ b/diy.py @@ -4,7 +4,9 @@ cost= {'苹果':5.2,'山竹':12.9,'香蕉':2.4,'荔枝':15,'葡萄':9.3,'桂圆' k=input('请输入水果名称:') v=input('请输入水果价钱:') # ?补充条件判断: - if # ?: +if k in cost: + if float(v)<cost[k] : + cost[k]=float(v) # ?更新价钱 print(k+'降价了,现价'+v+'元') else: -- libgit2 0.25.0