1. Mee Mee and Lee Lee have come to visitDee Dee and she remembers that there are cookies, muffins andsweets, so she takes three plates and puts the same amount of eachdessert on each plate and what is left on a table. In case there isnot enough of any dessert (<3), Dee Dee puts that dessert on thetable and nothing on each plate.
def dessert_distribution(qty_c, qty_m,qty_s):
Description: Given the quantity of cookies(qty_c), muffins (qty_m) and sweets (qty_s), return how they wouldbe distributed on each plate and on the table.
Parameters: quantity of cookies (qty_c),muffins (qty_m) and sweets (qty_s). Each integer. Assume qty_c,qty_m, qty_s are >=1 and <=7
Return value: How the desserts would bedistributed on each plate and on the table (string). Use a tab toseparate each distribution. If a dessert is not placed on a plateor on the table, do not print any character for it.
Examples: dessert_distribution(2,4,7) β '
dessert_distribution(3,6,3) β '
dessert_distribution(1,2,1) β '
2. Mandak has heard about Dexter's newexperiment and decides to buy what he needs to try to finish itfirst. On a list, he writes down (in order of priority) the itemshe must buy. He wants to know how many items can purchase with thecash he currently has.
def how_many_items(items, cash):
Description: Given a list of items andcash, return how many items can be purchase.
Parameters: items (list of strings), cash(float).
Assume The length of the list is >=1 and <=10
An item can be more than once in the list.
Return value: how many items can bepurchase (int), based on the items list and these prices:
Examples:
how_many_items(["hammer","screws","box nails"],33.57) β 3
how_many_items(["batteries","screws"],5) β 0
how_many_items(["screws","screws","screws"],1.76) β 2
Examples: dessert_distribution dessert_distribution dessert_distribution (2,4,7) β (3,6,3) β (1,2,1) β