NO import and NO dictionary 1. Mee Mee and Lee Lee have come to visit Dee Dee and she remembers that there are cookies,

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

NO import and NO dictionary 1. Mee Mee and Lee Lee have come to visit Dee Dee and she remembers that there are cookies,

Post by answerhappygod »

NO import and NO dictionary
1. Mee Mee and Lee Lee have come to visit Dee Dee and she remembers that there are cookies, muffins and sweets, so she takes three plates and puts the same amount of each dessert on each plate and what is left on a table. In case there is not enough of any dessert (<3), Dee Dee puts that dessert on the table 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 would be 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 be distributed on each plate and on the table (string). Use a tab to separate each distribution. If a dessert is not placed on a plate or 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 new experiment and decides to buy what he needs to try to finish it first. On a list, he writes down (in order of priority) the items he must buy. He wants to know how many items can purchase with the cash he currently has.
def how_many_items(items, cash):
Description: Given a list of items and cash, 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 be purchase (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
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply