标签:打印 update def test 成员 upd date info shu
#判断分数优良:fenshu(100)
#字典:
studInfo = {
‘qiusiyi‘:{‘sex‘:‘boy‘,‘number‘:38,‘score‘:90},
‘hesilin‘:{‘sex‘:‘girl‘,‘number‘:14,‘score‘:78},
‘caozhegngai‘:{‘sex‘:‘boy‘,‘number‘:24,‘score‘:88},
‘liusihan‘:{‘sex‘:‘girl‘,‘number‘:11,‘score‘:98},
‘luohongchi‘:{‘sex‘:‘boy‘,‘number‘:43,‘score‘:68},
}
#添加成员:
studInfo1 = {‘kongweijia‘:{‘sex‘:‘boy‘,‘number‘:13,‘score‘:55},}
studInfo.update(studInfo1)
#打印在90分以下的分数:
for item in studInfo:
if(studInfo[item][‘score‘]<90):
print(studInfo[item][‘number‘])
标签:打印 update def test 成员 upd date info shu
原文地址:https://blog.51cto.com/14887662/2515458