![](https://iknow-base.cdn.bcebos.com/lxb/notice.png)
救命,这道python题怎么做?
展开全部
代码如下:(编程不易,若认可请采纳)
# 字典存储信息
dict = {
"信息学院": {"助教": 14, "讲师": 20, "副教授": 40, "教授": 10},
"会计学院": {"助教": 10, "讲师": 20, "副教授": 35, "教授": 15},
"管工学院": {"助教": 23, "讲师": 43, "副教授": 30, "教授": 10}
}
# 计算各学院的教师总人数
total_teachers = {college: sum(values.values()) for college, values in dict.items()}
# 输出学院名称和总人数
for college, total in total_teachers.items():
print(college, "教师总人数:", total)
# 找出教师人数最少的学院
min_college = min(total_teachers, key=total_teachers.get)
print("教师人数最少的学院:", min_college)
运行结果:
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询