Question 20 (Advanced problem) DV DN! DW DW DW DW DW DW D You are a cooking robot who has been given an encoded string o

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

Question 20 (Advanced problem) DV DN! DW DW DW DW DW DW D You are a cooking robot who has been given an encoded string o

Post by answerhappygod »

Question 20 Advanced Problem Dv Dn Dw Dw Dw Dw Dw Dw D You Are A Cooking Robot Who Has Been Given An Encoded String O 1
Question 20 Advanced Problem Dv Dn Dw Dw Dw Dw Dw Dw D You Are A Cooking Robot Who Has Been Given An Encoded String O 1 (74.11 KiB) Viewed 18 times
Question 20 (Advanced problem) DV DN! DW DW DW DW DW DW D You are a cooking robot who has been given an encoded string of ingredients and dish names. You are tasked with reading in this string and determining how many of each dish you can make. The key for the string encoding is below. Ingredients: M = Milk E = Eggs F = Flour S = Sugar Dishes: P = Pancakes D = Danish C = Custard This means that the string MEMMSSFCMMEP means you have 2 dishes to cook. The first is custard, for which you have 3 Milk, 1 Eggs, 2 Sugar, 1 Flour. The second is Pancakes, for which you have 2 Milk and 1 Eggs. For this example, we would be able to make the custard, but not the pancakes. Note: after you have read a character corresponding to a dish, you may only use the ingredients seen since the last dish character (i.e, after each dish, you must clear you ingredients list) The recipes for the dishes are as follows: Pancakes: 2 Eggs, 1 Milk, 1 Flour, 1 sugar Danish: 2 Eggs, 2 Milk, 2 Flour, 2 sugar
The recipes for the dishes are as follows: 070 0÷0 070 070 070 070 070 | Pancakes: 2 Eggs, 1 Milk, 1 Flour, 1 sugar Danish: 2 Eggs, 2 Milk, 2 Flour, 2 sugar Custard: 3 Milk, 1 Eggs You must return the number of complete dishes you can make in a list of the form [#pancake, #danish, #custard, #None], where the number at index 0 is the number of pancakes that can be made, the number at index 1 is the number of danishes that can be made, the number at index 2 is the number of custards that can be made and the number at index 3 is the number of dishes that could not be made with the preceding ingredients. Note: Do not worry about calculating multiple dishes per batch of ingredients, simply determine if a dish can or can not be created70 def get_dishes (cook_string): input: a string of characters representing a list of ingredients separated by a character representing a dish to make output: a list containing the number of each dish that can be made and the total number of dishes that could not be made Examples: >>>get_dishes ("MEMMSSFCMMEP") [0, 0, 1, 1] >>> get_dishes ("MMFFSSEEPMFSEMFSEDSSSC") [1, 1, 0, 1] >>> get_dishes ("EEEMMFSPMMEC") [1, 0, 0, 1] IT 11 TE DI 2 ‒‒‒‒‒‒‒‒‒‒‒‒‒ Atsi
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply