square_account_list=[
{"name":"John","age":22,"contury":"England","sex":"male","height":180,"weight":160},
{"name":"Tom","age":30,"contury":"America","sex":"female","height":180,"weight":150},
{"name":"Dick","age":27,"contury":"England","sex":"male","height":187,"weight":150},
{"name":"Lucy","age":28,"contury":"America","sex":"female","height":180,"weight":150},
{"name":"David","age":30,"contury":"America","sex":"male","height":120,"weight":150},
{"name":"Bill","age":30,"contury":"America","sex":"male","height":130,"weight":150},
{"name":"Jian","age":18,"contury":"China","sex":"female","height":180,"weight":150}]
# first_one=square_account_list[0]
# if first_one["name"]=="David":
# print(first_one)
# else:
# print("他不是David")
#for循环-遍历下标-通过下标来获取数据
#[0,1,2,3,4,5,6]
for index in range(0,len(square_account_list)):
person_name=square_account_list[index]["name"]
if person_name=="David":
print(person_name)
break
else:
print("他不是David")
'''
#for循环-遍历列表的值-直接取值
for item in square_account_list:
if item["name"]=="David":
print(item)
else:
print("他不是David")
'''
'''
for item in square_account_list:
if item["age"]>20 and item["sex"]=="female":
print(item["name"])
else:
print("====")
'''
for item in square_account_list:
if item["age"]>20 or (item["sex"]=="female" and item["height"]>160):
print(item["name"])
else:
print("====")