首页 > 其他 > 详细

test6

时间:2020-07-31 20:58:33      阅读:110      评论:0      收藏:0      [点我收藏+]
#判断分数优良:
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‘])

test6

原文:https://blog.51cto.com/14887662/2515458

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!