Commit 6fa16717 by BellCodeEditor

auto save

parent 62cad33d
Showing with 38 additions and 0 deletions
#1,创建一个字典name,
#2.查询王五的年龄
#修改,
#3.增加小明,16岁在字典里
'''
创建一个字典dict={键值对}
查询字典,通过建查询dict["键"]
修改 ,通过建,修改值,,,,name["键"]=40
增加一个键值对,dict["键"]=值
删除1 name.pop("键")
2 del name
3 name.clear()
遍历
1遍历所有的键
for i in dict.keys():
2遍历所有的值
for i in dict.values():
3遍历所有的键值
for k,v in dict.items():
'''
name={"张三":29,"李四":{"年龄":25,"性别":"男","成绩":90},"王五":39,"赵六":40}
lisi_name=name["李四"]
for k,v in lisi_name.items():
print(k,v)
\ No newline at end of file
def test1():
a=5
b=2
c=4
a+b
def test2():
q=3
e=5
a+b
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