Commit 39ad2c53 by BellCodeEditor

auto save

parent 2c845b91
Showing with 35 additions and 5 deletions
# 请注释掉上面的代码,并在下一行创建一个名为dict_hero的字典 #提取'猴队长'的值
dict_hero1=['猴三',10,'猴一',21,'猴五',22,'猴队长',29,'猴七',30] # dict_hero1={'猴三':10,'猴一':21,'猴五':22,'猴队长':29,'猴七':30}
print(dict_hero1) # print(dict_hero1['猴队长'])
# # #修改'猴七'的值为100
# dict_hero2={'猴三':10,'猴一':21,'猴五':22,'猴队长':29,'猴七':30}
# dict_hero2['猴七']=100
# print(dict_hero)
#增添'猴二':56
# dict_hero1={'猴三':10,'猴一':21,'猴五':22,'猴队长':29,'猴七':30}
# dict_hero1['猴二']=56
# print(dict_hero1)
# #查看'猴七'的值
# dict_hero2={'猴三':10,'猴一':21,'猴五':22,'猴队长':29,'猴七':30}
# if '猴七' in dict_hero2:
# print(dict_hero2['猴七'])
#提取'猴一'的值
dict_hero1={'猴三':10,'猴一':21,'猴五':22,'猴队长':29,'猴七':30}
print(dict_hero1['猴一'])
#修改'猴三'的值为100
dict_hero2={'猴三':10,'猴一':21,'猴五':22,'猴队长':29,'猴七':30} dict_hero2={'猴三':10,'猴一':21,'猴五':22,'猴队长':29,'猴七':30}
print(dict_hero2) dict_hero2['猴三']=100
\ No newline at end of file print(dict_hero2)
#增添'猴四':37
dict_hero3={'猴三':10,'猴一':21,'猴五':22,'猴队长':29,'猴七':30}
dict_hero3['猴四']=37
print(dict_hero3)
#查看'猴七'的值
dict_hero4={'猴三':10,'猴一':21,'猴五':22,'猴队长':29,'猴七':30}
if '猴七' in dict_hero4:
print(dict_hero4['猴七'])
\ No newline at end of file
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