Commit f05092f3 by BellCodeEditor

auto save

parent 26c63e21
Showing with 21 additions and 6 deletions
dice_list={"name":"xiaoming","abc":"xiaoli"}
for i,v in dice_list.items():
print(i)
print(type(i))
...@@ -24,13 +24,22 @@ for k,v in score.items(): ...@@ -24,13 +24,22 @@ for k,v in score.items():
# 查询并打印出输入的名字对应的所有科目的成绩 # 查询并打印出输入的名字对应的所有科目的成绩
while True : #while True :
name = input("名字:")
if name in score :
a = score[name]
name = input("名字:") #输入查询的名字
if name in score : #判断名字在不在字典里
a = score[name] #查询出名字所对应的成绩
print('*'*30) print('*'*30)
for k,v in a.items(): for k,v in a.items():#遍历各科成绩
print(k,v) print(k,v) #输出各科成绩
break break
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