Python123的真实评阅系统
members = {'张三':['人力部',5500],
'李四':['后勤部',4500],
'王三':['市场部',6500],
'赵六':['开发部',8500]
}
sal_dep = {}
for key in members:
print('{}的工资是:{}, 部门是{}'.format(key, members[key][1], members[key][0]))
sal_dep[members[key][1]] = members[key][0]
max_val = max(sal_dep)
max_name = sal_dep[max_val]
print('工资最高的部门是:{},该部门工资是:{}'.format(max_name,max_val))
第二种解题方法
members = {'张三':['人力部',5500],
'李四':['后勤部',4500],
'王三':['市场部',6500],
'赵六':['开发部',8500]
}
ls_name=[]
ls_department=[]
ls_wage=[]
for i in members:
ls_name.append(i)
ls_department.append(members[i][0])
ls_wage.append(members[i][1])
wage_max=ls_wage.index(max(ls_wage))
for i in range(len(ls_name)):
print("{}的工资是:{}, 部门是{}".format(ls_name[i],ls_wage[i],ls_department[i]))
print('工资最高的部门是:{},该部门工资是:{}'.format(ls_department[wage_max],ls_wage[wage_max]))
第三种解题方法
members = {'张三':['人力部',5500],
'李四':['后勤部',4500],
'王三':['市场部',6500],
'赵六':['开发部',8500]
}
for i in members:
print("{}的工资是:{}, 部门是{}".format(i,members.get(i)[1],members.get(i)[0]))
n=0
for i in members:
wage=members.get(i)[1]
if wage>0:
n=wage
for i in members:
wage=members.get(i)[1]
if wage==n:
print('工资最高的部门是:{},该部门工资是:{}'.format(members.get(i)[0],members.get(i)[1]))
Python123计算机等级考试《二级Python语言与程序设计》之考试须知
Python123计算机等级考试《二级Python语言与程序设计》之考试大纲
Python123计算机等级考试《二级Python语言与程序设计》之公共基础知识