#判断分数优良: def fenshu(shu): if(shu<60): print("不及格") if(60<=shu and 80>shu): print("中") if(80<=shu and 90>shu): print("良好") if(shu>=90 and shu<100): print('优') if(shu==100): print('优+')
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'])