What would be the output of the following code? If there is…

What would be the output of the following code? If there is an error, write “ERROR” numbers = [8, 15, 22, 9, 31]total = 0for n in numbers: if n > 10: if n % 2 == 1: total += 5 else: total -= 2 else: if n >= 8: total += n else: total -= 4print(total) 

OnlineGDB: LINK Online Python: LINKWrite a function called d…

OnlineGDB: LINK Online Python: LINKWrite a function called department_budget that takes a nested dictionary 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: {}  

What would be the output of the following code? If there is…

What would be the output of the following code? If there is an error, write “ERROR” def transform_list(nums, depth): if depth == 0: return nums else: new_nums = [nums[i] * (i + 1) for i in range(len(nums))] return transform_list(new_nums, depth – 1)result = transform_list([2, 3, 1], 3)print(sum(result))

What would be the output of the following code?  def modify_…

What would be the output of the following code?  def modify_data(data):    value = data.get(‘x’, 0) + data.get(‘y’, 0)    data.clear()    data[‘result’] = value    return data.get(‘z’, ‘Not found’)numbers = {‘x’: 3, ‘y’: 7, ‘z’: 5}print(modify_data(numbers))