test6

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了test6相关的知识,希望对你有一定的参考价值。

#判断分数优良:
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的主要内容,如果未能解决你的问题,请参考以下文章