Please have the function written in python, thank you!
thanks for the question, here is the implemented function
=============================================================================
class Pharmacy:
def
__init__(self,inventory,unit_prices):
self.inventory=inventory
self.unit_prices=unit_prices
class Prescription:
def
__init__(self,patient,drug_name,quantity):
self.patient=patient
self.drug_name=drug_name
self.quantity=quantity
def costliest_drugs(pharmacy):
inventory=pharmacy.inventory
max_quantity=0
drug_name_with_max_count=0
for drug_name,quantity
in inventory.items():
if
max_quantity<quantity:
max_quantity=quantity
drug_name_with_max_count=drug_name
return
drug_name_with_max_count
def
restock_drug(pharmacy,drug_name,quantity):
if quantity<=0:
return
-1
inventory =pharmacy.inventory
unit_prices=pharmacy.unit_prices
if drug_name not
in unit_prices.keys():
return
-4
if drug_name not
in inventory.keys():
inventory[drug_name]=quantity
else:
inventory[drug_name]+=quantity
return
inventory.get(drug_name)
=============================================================================
thanks !
Please have the function written in python, thank you! Preliminaries For this assignment you will be working with the following classes, which are available in the file homework5.classes.py: class P...
PYHTON Preliminaries For this assignment you will be working with the following classes, which are available in the file homework5-classes.py: class Pharmacy: def _init_(self, inventory, unit_prices) self.inventory - inventory self.unit_prices-unit_prices class Prescription: definit_(self, patient, drug_name, quantity): self.patient- patient self.drug_namedrug_name self.quantity - quantity You will be asked to write several functions that work with the Prescription and Pharmacy classes. To complete this assignment you may write any helper functions you like inside your homework5.py file. Pharmacy class attributes: * inventory: A...
python Preliminaries For this assignment you will be working with the following classes, which are available in the file homework5-classes.py: class Pharmacy: def _init_(self, inventory, unit_prices) self.inventory - inventory self.unit_prices-unit_prices class Prescription: definit_(self, patient, drug_name, quantity): self.patient- patient self.drug_namedrug_name self.quantity - quantity You will be asked to write several functions that work with the Prescription and Pharmacy classes. To complete this assignment you may write any helper functions you like inside your homework5.py file. Pharmacy class attributes: * inventory: A...