Commit cc9c6a81 by BellCodeEditor

save project

parent 5ab88987
Showing with 16 additions and 5 deletions
score = {'语文':91,'数学':88,'英语':85} s1 = {"语文":91,"数学":88,"英语":85}
s2 = {"语文":97,"数学":98,"英语":90}
# 请对字典进行遍历,将保存的分数以键值对的形式提取打印出来 s3 = {"语文":95,"数学":100,"英语":93}
score = {"悟空":s1,"诺依":s2,"小贝":s3}
while True:
name = input("请输入要查询的名字,推出请按TNT:")#输入名字
if name == 'TNT':
break
if name in score:
s = score[name] #根据名字找到对应的成绩表
#遍历是s,打印出对应的成绩
for k,v in s.items():
print(k,v)
else:
print("没有这个人的信息")
\ No newline at end of file
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