Commit db328e57 by BellCodeEditor

save project

parent dd56e83f
Showing with 10 additions and 6 deletions
...@@ -8,6 +8,7 @@ score = {'悟空': student1, '诺依': student2, '小贝': student3} ...@@ -8,6 +8,7 @@ score = {'悟空': student1, '诺依': student2, '小贝': student3}
# 查询并打印出输入的名字对应的所有科目的成绩 # 查询并打印出输入的名字对应的所有科目的成绩
while True : while True :
name = input("名字:") name = input("名字:")
if name in score : if name in score :
a = score[name] a = score[name]
......
...@@ -2,16 +2,19 @@ studen1={'语文':0,'数学':0,'英语':0} ...@@ -2,16 +2,19 @@ studen1={'语文':0,'数学':0,'英语':0}
studen2={'语文':0,'数学':0,'英语':0} studen2={'语文':0,'数学':0,'英语':0}
studen3={'语文':0,'数学':0,'英语':0} studen3={'语文':0,'数学':0,'英语':0}
scote={'悟空':studen1,'诺依':studen2,'小贝':studen3} scote={'悟空':studen1,'诺依':studen2,'小贝':studen3}
while True:
name = input("名字:") print("请输入查询的名字,退出请按q")
print('*'*30) name = input("名字:")
if name in scote : print('*'*30)
if name in scote :
scote = scote[name] scote = scote[name]
for k,v in scote.items(): for k,v in scote.items():
print(k,v) print(k,v)
print('*'*30) print('*'*30)
elif name=='q':
else: print("结束")
break
else:
print("查询错误,请输入正确的名字") print("查询错误,请输入正确的名字")
print('*'*30) print('*'*30)
......
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