Commit 0b4ad0fd by BellCodeEditor

auto save

parent a6425b4b
Showing with 6 additions and 0 deletions
...@@ -11,5 +11,10 @@ ...@@ -11,5 +11,10 @@
# 请注释掉上面的代码,并在下一行创建一个名为dict_hero的字典 # 请注释掉上面的代码,并在下一行创建一个名为dict_hero的字典
dict_hero={"1":30,"2":30,"3":50,"4":80} dict_hero={"1":30,"2":30,"3":50,"4":80}
dict_hero["4"]=100 #字典中值的修改 dict_hero["4"]=100 #字典中值的修改
#值的添加
dict_hero["5"],dict_hero["6"]=105,120
#判断105在不在字典中 如果要输出值要通过字典中的Key去找value值
if "5" in dict_hero:
print(dict_hero["5"])
print(dict_hero) print(dict_hero)
print(len(dict_hero)) print(len(dict_hero))
\ 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