我一直试图弄清楚它有一段时间了,而不是最擅长编程。这是我到目前为止所拥有的。
字典的键应该是列表中员工的头衔,值是具有该特定头衔的员工数。
employees = [
{
"email": "jonathan2532.calderon@gmail.com",
"employee_id": 101,
"firstname": "Jonathan",
"lastname": "Calderon",
"title": "Mr",
"work_phone": "(02) 3691 5845"
},
{
"email": "christopher8710.hansen@gmail.com",
"employee_id": 102,
"firstname": "Christopher",
"lastname": "Hansen",
"title": "Mr",
"work_phone": "(02) 5807 8580"
},
{
"email": "isabella4643.dorsey@gmail.com",
"employee_id": 103,
"firstname": "Isabella",
"lastname": "Dorsey",
"title": "Mrs",
"work_phone": "(02) 6375 1060"
},
{
"email": "barbara1937.baker@gmail.com",
"employee_id": 104,
"firstname": "Barbara",
"lastname": "Baker",
"title": "Ms",
"work_phone": "(03) 5729 4873"
}
]
#my work
for i in employees:
print(i['title'])
employees.count('title')
print()
#my output:
Mr
Mr
Mrs
Ms
#expected output:
{'Ms': 1, 'Mrs': 1, 'Mr': 2}
胡子哥哥
呼啦一阵风
米琪卡哇伊
相关分类