You're a regional manager for an office beverage sales company, and right now you're in charge of paying your sales team their monthly commissions.
Sales people get paid using the following formula for the total commission: 6.2%
of profit, with no commission for any product to total less than 0
.
Create a function that takes two dictionaries, one showing the sales figure per salesperson for each product they sold, and another for the expenses by product per salesperson. It should return a dictionary of the sales people with their total commissions rounded to two decimal places.
calculate_commissions(
{ # Revenue
"Frank": {
"Tea": 120,
"Coffee": 243,
},
"Jane": {
"Tea": 145,
"Coffee": 265,
}
},
{ # Expenses
"Frank": {
"Tea": 130,
"Coffee": 143,
},
"Jane": {
"Tea": 59,
"Coffee": 198
}
}
) -> {
"Frank": 6.2,
"Jane": 9.49
}