diff --git a/diy1.py b/diy1.py index c300f34..ad4ee32 100644 --- a/diy1.py +++ b/diy1.py @@ -1,4 +1,7 @@ -# 请注释掉上面的代码,并在下一行创建一个名为dict_hero的字典 -dict_hero={'猴三':10,'猴一':21,'猴五':22,'猴队长':29,'猴七':30} -print(dict_hero) -dict_hero["猴十"]=32 \ No newline at end of file +dict={'可口可乐':3,'旺仔牛奶':4,'农夫山泉':1,'辣条':3,'巴西烤肉':2,'果冻':4,'乐事':5,'奥利奥':10,'巧克力':6} +j=input("你要买啥子") +if j in dict: + print((dict[j])+'一亿元') + +else: + print('没货,退!退!退!') \ No newline at end of file diff --git a/quiz.py b/quiz.py index 85aa09a..0754eb1 100644 --- a/quiz.py +++ b/quiz.py @@ -1,5 +1,7 @@ -# 直接运行以下代码,说说你的发现: -list_hero=['赵一',30,'丁二',37,'孙五',52,'王猛',89,'周亮',98] -dict_hero = {'赵一':30,'丁二':37,'孙五':52,'王猛':89,'周亮':98} -print(len(list_hero)) -print(len(dict_hero)) \ No newline at end of file +dict={'可口可乐':3,'旺仔牛奶':4,'农夫山泉':1,'辣条':3,'巴西烤肉':2,'果冻':4,'乐事':5,'奥利奥':10,'巧克力':6} +j=input("你要买啥子") +if j in dict: + print((dict[j])+'一亿元') + +else: + print('没货,退!退!退!') \ No newline at end of file