Commit 3f480308 by BellCodeEditor

save project

parent ea38d86c
Showing with 17 additions and 9 deletions
student1 = {'语文': 129, '数学': 146, '英语': 148,'总分':423} student1 = {'语文': 222, '数学': 230, '英语': 250,'总分':702}
student2 = {'语文': 93, '数学': 118, '英语': 149,'总分':360} student2 = {'语文': 2, '数学': 1, '英语': 500,'总分':503}
student3 = {'语文': 145, '数学': 115, '英语': 134,'总分':394} student3 = {'语文': 229, '数学': 234, '英语': 250,'总分':713}
score = {'沙安航': student1, '王中博': student2, '张天佑': student3} score = {'沙安航': student1, '王中博': student2, '张天佑': student3}
...@@ -8,12 +8,20 @@ score = {'沙安航': student1, '王中博': student2, '张天佑': student3} ...@@ -8,12 +8,20 @@ score = {'沙安航': student1, '王中博': student2, '张天佑': student3}
# 查询并打印出输入的名字对应的所有科目的成绩 # 查询并打印出输入的名字对应的所有科目的成绩
while True : while True :
name = input("名字:") print("请输入大才子的大名,退出q")
name = input("姓名:")
print("*" * 30)
if name in score : if name in score :
a = score[name] info = score[name]
print('*'*30) for k,v in info.items():
for k,v in a.items():
print(k,v) print(k,v)
print('*'*30)
elif name == "q":
break break
else: else:
print('输入错误') print("错误,重新输入")
\ No newline at end of file print('*'*30)
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