Commit d6466c62 by BellCodeEditor

auto save

parent e7aeaf76
Showing with 34 additions and 2 deletions
......@@ -4,7 +4,39 @@ student3 = {'语文': 95, '数学': 100, '英语': 93}
score = {'悟空': student1, '诺依': student2, '小贝': student3}
name = input("名字:")
'''
###方法一###
# for m in score:
# if m == name :
# print(score[m])
####方法二####
for m , n in score.items():
if m == name:
print(m,n)
'''
while True:
print('请在下列输入框中输入名字,退出请输入q')
name = input("名字:")
#判断输入名字是否在字典中
if name in score:
print('*'*10)
#提取对应姓名的分数
b = score[name]
#提取键、值
for k , v in b.items():
print(k,v)
print('*'*10)
elif name == "q":
break
else:
print("输入姓名有误,请重新输入")
# 查询并打印出输入的名字对应的所有科目的成绩
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