程序填空题:电话本查询
在如下通讯录中查找对应的联系人:
contacts = [
{"name": Qi Lee, "mobile": 13946253589},
{"name": Anny Hofman, "mobile": 13651323101}
]
### 输入示例1:
in
Qi Lee
### 输出示例1:
out
13946253589
### 输入示例2:
in
Yaping Guo
### 输出示例2:
out
用户不存在
Python
contacts = [
{"name": "Qi Lee", "mobile": 13946253589},
{"name": "Anny Hofman", "mobile": 13651323101}
]
name = input()
isFound =
for :
if :
isFound = True
print(contact["mobile"])
break
if isFound != True:
print("用户不存在")
答案:
第1空:False
第2空:contact in contacts
第3空:contact["name"] == name
contacts = [
{"name": Qi Lee, "mobile": 13946253589},
{"name": Anny Hofman, "mobile": 13651323101}
]
### 输入示例1:
in
Qi Lee
### 输出示例1:
out
13946253589
### 输入示例2:
in
Yaping Guo
### 输出示例2:
out
用户不存在
Python
contacts = [
{"name": "Qi Lee", "mobile": 13946253589},
{"name": "Anny Hofman", "mobile": 13651323101}
]
name = input()
isFound =
for :
if :
isFound = True
print(contact["mobile"])
break
if isFound != True:
print("用户不存在")
答案:
第1空:False
第2空:contact in contacts
第3空:contact["name"] == name