Commit c23d134c by BellCodeEditor

auto save

parent 1be67cba
Showing with 12 additions and 0 deletions
...@@ -9,5 +9,17 @@ ...@@ -9,5 +9,17 @@
# break # break
# print(list_hero) # print(list_hero)
# 请注释掉上面的代码,并在下一行创建一个名为dict_hero的字典 # 请注释掉上面的代码,并在下一行创建一个名为dict_hero的字典
#创建字典
dict_hero={'猴三':10,'猴一':21,'猴五':22,'猴队长':29,'猴七':30} dict_hero={'猴三':10,'猴一':21,'猴五':22,'猴队长':29,'猴七':30}
print(dict_hero) print(dict_hero)
#修改字典中键对应数值
dict_hero['猴五']=25
print(dict_hero)
#增加键
dict_hero['王尼玛']=34
#查
if '王尼' in dict_hero:
print(dict_hero['王尼'])
else:
print('no')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment