Given the table of purchases tabled in the local store, complete the following functions below: itemName cost amount suc
Posted: Fri Apr 29, 2022 6:56 am
Given the table of purchases tabled in the local store, complete the following functions below: itemName cost amount success bread 100 3 milk 300 6 pizza 1000 5 1 apple juice 500 7 0 table d = { "itemName': ['bread', 'milk', pizza', 'apple juice'). 'cost' :[100, 3001000, 500 1 'amount':[36. 5, 7 1. 'success': [1. 1. 1, 0 ] } 1) The function that returns number of successful purchases 2) The function that determines the total profit, computed as number of items sold multiplied by their prices (note that you should avoid including unsuccessful operations into a profit calculation). 3) The function that return a list of item names that were sold and costs less than a certain amount determined by a limit parameter of the function. 4) The function that return the price of the given item. 5) The function that return total cost of all purchased items.