Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Define a tunction naned asd_to_orderdem_index, stock 1tot, orders, which takes an index a list of products and a list of orders s parameters. The function
Define a tunction naned asd_to_orderdem_index, stock 1tot, orders, which takes an index a list of products and a list of orders s parameters. The function should do the following Append a tuple consisting of the description and the price of the product at the specified index of the stock list onto the hof orders Subtract 1 from the product's quantity value in the stock list - the quantity is now remove the product from the stock list For example: Test itens - ( 23.Coca Cola Soft Drink 500n1,4,2', '12,L3.50 Orink teson & Peeros soon, 4.1, 33, Bice Drink can on, 3.5,8', 24, Vitalise Energy Drink Soon, 3,5,5"} oros - 1 350_to_endeesce, Etons, orders) 36 to cresci, tos, orders) pricorders) pries(itesto] prin stens[21) Itens ("24, Coca Cole Soft Drink 52,4,2 12,4&P Soft Drink Lenco & Paeroe som, 4,2", 13; lce Drink con 501, 5.5,0", 24, Vitalise treng Drink 50, 3.5,2 "15, pup Weter Spring 75002, 2.5, orders dd_to_orders(2, Itens, orders) ___orders. Its, orders) ad_to_oeders(0 Itens, onders) to gedersco, Itens, orders) print corders) priet(test) print(tens (3) print(tes[23) Puno Water 12 Soring 75002, 2.5,3, 36, Tax Chocolate Bar seg, 2.5,12, 17, Nestle Kit cot Chocolate Bar 4 Finger, 2.4,15, 28, Seickers Chocolate Bar 5, 2, 13, 19, Cadbury Chocolate Bar Crunchie sog. For example: Input Result 5 'Coca Cola Soft Drir 50061', '2'), ('L & P Soft Drink Lemon & Peere 500n1', '4') 13. Coca Cola Soft Drink 50001,4,1 13. Blue Drink con 500m, 3.5,8 20, Cadbury Picnic Chexolate tar 46,2,19' 30 COV Blue Drink can SonL", "3.5'), (Blue Drink can seem, 9.5), ('Coca Cola Soft Drink 50m, 4, ('L & Soft Drink Lemon & Paeroa send, 12, L & Soft Drink Leon & Peeron 501,4,1 13,V Blue Orink con 500L, 3.5,6 14, Vitalise Energy Drink 500m, 3.5,2 Eck only + - '22. Coca Cola Soft Drink 502,4,2 12, L & P Soft Drink Lemon & Perce 50m2,4,15 '13. Blue Drink can scor, 3.5,8% 34, Vitalise Energy Drink Scon1,3.5.53 50 to orders. itens, orders) to_ordees(, Stens, ce ders) torders) ottens (ites[23) - '. Coca Cola Soft Drink 500n1, 4.112,L & P Soft Drank Loan & Perro scom, 4,2, -23. Blue Oran consort, 3.5.0', '1,V Vitalise Energy Drink soon.3-5,2", "s. Puno ter z Soring som r. _to_orders(2. itens, orders) co_orders 2. itens, sers) _to_ordersto, tens, orders) to_ordeeso, itens, orders) Corders) nt (test) sites (13) (Stens2) Input Expected 5 t(Coca Cola Soft Drink 580ml', '4'), CL & P Soft Drink Lemon & Paeroa 50001, 04) 11, Coca Cola Soft Drink $28m1,4,1 13. V Blue Drink can 500m, 3.5,8 1 10 CV Blue Drink can sent', '3.5), ("V Blue Drink can seeme", 3.5'), ('Coca Cola Soft Drink seml', '4'), ('L & P Soft Drink Lemon & Pacros semi 12,L & P Soft Drink Lemon & Paeroa 5en1,4,1 13,V Blue Drink con sont,3,5,6 14,v Vitalise Energy Drink 581, 3.5,2
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started