OnlineGDB: LINK Online Python: LINKWrite a function called d…
Questions
OnlineGDB: LINK Online Pythоn: LINKWrite а functiоn cаlled depаrtment_budget that takes a nested dictiоnary representing company departments and their employees with salaries, and returns a dictionary showing the total budget (sum of all salaries) for each department. Inputs: company: a dictionary where: Keys are department names (strings) Values are lists of dictionaries, where each dictionary represents one employee with keys "name" (employee name) and "salary" (integer) Output: A dictionary where: Keys are department names (strings) Values are the total salary budget for that department (integer) Departments with no employees should have a budget of 0 Example 1: company = { "Engineering": [ {"name": "Alice", "salary": 90000}, {"name": "Bob", "salary": 85000}, {"name": "Charlie", "salary": 95000} ], "Sales": [ {"name": "Diana", "salary": 70000}, {"name": "Eve", "salary": 75000} ], "HR": [ {"name": "Frank", "salary": 60000} ], "Marketing": []}print(department_budget(company))# Expected output: {'Engineering': 270000, 'Sales': 145000, 'HR': 60000, 'Marketing': 0} Example 2: company2 = { "IT": [ {"name": "John", "salary": 80000}, {"name": "Jane", "salary": 82000} ], "Finance": [ {"name": "Mike", "salary": 95000} ]}print(department_budget(company2)) # Expected output: {'IT': 162000, 'Finance': 95000}print(department_budget({})) # Expected output: {}
Они __________________________ физику в школе.
Она __________________________ в университете 3 года.