Skip to content
  • P
    Projects
  • G
    Groups
  • S
    Snippets
  • Help

Administrator / lesson9_2

  • This project
    • Loading...
  • Sign in
Go to a project
  • Project
  • Repository
  • Issues 0
  • Merge Requests 0
  • Pipelines
  • Wiki
  • Snippets
  • Members
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Files
  • Commits
  • Branches
  • Tags
  • Contributors
  • Graph
  • Compare
  • Charts
Switch branch/tag
  • lesson9_2
  • diy2.py
Find file
BlameHistoryPermalink
  • BellCodeEditor's avatar
    save project · 2d72cbcc
    BellCodeEditor committed 4 years ago
    2d72cbcc
diy2.py 628 Bytes
Edit
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

student1= {'语文':91,'数学':130,'英语':120}
student2={'语文':90,'数学':102,'英语':120}
student3={'语文':90,'数学':110,'英语':120}
score={'悟空':student1,'诺依':student2,'小贝':student3}

while True:
# 请对字典进行遍历,将保存的分数以键值对的形式提取打印出来
    print("请输入你要查询的姓名,按q退出查询")
    name=input("名字:  ")
    if name in score:
        for k,v in score[name].items():
            print(k,v)
        print("*"*30)
    elif name== "q":
        print("程序结束")
        break
    else:
        print("名字错误,请重新输入")