Commit 661e413f by BellCodeEditor

auto save

parent b7498cbe
Showing with 19 additions and 17 deletions
student1 = {'语文': 91, '数学': 88, '英语': 85} # 1创建一个字典,字典内包含张三,李四,王五,赵六4人的
student2 = {'语文': 97, '数学': 98, '英语': 90} # 英语,数学,科学成绩
student3 = {'语文': 95, '数学': 100, '英语': 93} # 2,做一个分数查询系统,重复查询,
score = {'悟空': student1, '诺依': student2, '小贝': student3} # 输入姓名,返回各科成绩,
# 如姓名有误,返回姓名错误
# 按q推出查询,需要有按q推出的提示。
a={
'张三':{'英语':91,'数学':94,'科学':823},
'李四':{'英语':92,'数学':94,'科学':839},
# 查询并打印出输入的名字对应的所有科目的成绩 '王五':{'英语':90,'数学':93,'科学':82},
while True : '赵六':{'英语':90,'数学':95,'科学':83}
name = input("名字:") }
if name in score : while True:
a = score[name] name=input("输入需要查询的名字")
print('*'*30) if name=='q':
for k,v in a.items():
print(k,v)
break break
if name in a:
for i,j in a[name].items():
print(i,j)
else: else:
print('输入错误') 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