我要過濾特定部門的工資和總結,我已經做了上半場,但添加這些工資,任何一個可以通過查看下面的代碼表明....如何總結選擇性字典值
chennai = {"name": "Kumar", "Department": "Sales", "Age": 39,"Salary": 20}
mumbai = {"name": "Suresh","Department": "Finance", "Age": 53,"Salary": 35}
delhi = {"name": "Babu", "Department": "QC", "Age": 28,"Salary": 10}
kolkata = {"name": "Satish","Department": "Production","Age": 34,"Salary": 15}
madurai = {"name": "Dev", "Department": "Management","Age": 45,"Salary": 23}
hyderabad = {"name": "Rani", "Department": "Marketing", "Age": 46,"Salary": 25}
bengalore = {"name": "Devi", "Department": "Production","Age": 24,"Salary": 5}
cochin = {"name": "Sarath","Department": "Production","Age": 26,"Salary": 12}
jaipur = {"name": "Senu", "Department": "Production","Age": 25,"Salary": 8}
shimla = {"name": "Kumari","Department": "Management","Age": 37,"Salary": 20}
lucknow = {"name": "Sanjay","Department": "Marketing", "Age": 52,"Salary": 30}
employ = [chennai,mumbai,delhi,kolkata,madurai,hyderabad,bengalore,cochin,jaipur,shimla,lucknow]
#Finding Production unit salary expenditure
for x in employ:
sums = 0
if x ["Department"] == 'Production':
print x["Salary"]