Commit b2b63a35 by BellCodeEditor

save project

parent 1354bc2a
Showing with 15 additions and 8 deletions
...@@ -3,10 +3,17 @@ s2 = {'语文':96,'数学':100,'英语':100} ...@@ -3,10 +3,17 @@ s2 = {'语文':96,'数学':100,'英语':100}
s3 = {'语文':4,'数学':7,'英语':5} s3 = {'语文':4,'数学':7,'英语':5}
student= {"买买买":s1,"好几家":s2,"导弹王":s3} student= {"买买买":s1,"好几家":s2,"导弹王":s3}
# 请对字典进行遍历,将保存的分数以键值对的形式提取打印出来 # 请对字典进行遍历,将保存的分数以键值对的形式提取打印出来
name = input("请输入姓名:") while True:
if name in student: name = input("输入 q 退出,请输入姓名:")
score = student[name] print("~"*30)
for k,v in score.items(): if name == "q":
print(k,v) print("程序退出")
else: break
print("输入错误")
\ No newline at end of file if name in student:
score = student[name]
for k,v in score.items():
print(k,v)
else:
print("输入错误")
print("~"*30)
\ 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