#已知一个字典中包含若干员工信息(性别和姓名),请编写一个程序,删除性别为男的员工信息
def delMale(dict):
keys = []
values = []
for (key,value) in dict.items():
keys.append(key)
values.append(value)
for value in values:
if value == 0:
index = values.index(value)
arrKey = keys[index]
del dict[arrKey]
values[index] = 3
keys[index] = "占位"
dic = {"小明":0, "小红":1,"小兰":1,"小白":0}
print("删除前:%s"%dic)
delMale(dic)
print("删除后:%s"%dic)