Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please use the python to answer this, thanks Write a function cafe day that which takes one argument, orders, which is a list of drink

Please use the python to answer this, thanks image text in transcribed
Write a function cafe day that which takes one argument, orders, which is a list of drink orders for the day at a caf. The list orders contains one or more sub-lists, in which each sub-list represents a particular drink order. In each sub-list, there are four elements, in this order 1. A string that indicates the customer's membership, which will be one of these three categories: Platinum membership is represented by the letter P .Gold membership is represented by the letter G Silver membership is represented by the letter' S. 2. An integer that represents the number of large drinks for the particular order. . An integer that represents the number of medium drinks for the particular order. 4. An integer that represents the number of small drinks for the particular order. Your function should process all orders, then return a floaring-point number that represents the revenue generated for the day in dollars. Dowt round the return valne! The prices for different sizes are as follows: Size $3.50 50 Medium In addition, there will be different privileges depending on different memberships, as described below Membership Privilege Platinum If the customer gets at most 3 free small drinks. If the customer purchases at least 10 drinks (in any combination then he/she gets a 20% discount. or more medium lver customer receives 2% off of total price regardless of number of drinks Invalid values: Your function should be able to handle invalid values outlined below. In these cases, skip the entire drink order and continue to the next one. Valid drink orders have the following characteristics: Each sub list has exactly four values. The first element in the sub-list. which is the membership, is one of the three stringsG or'S lowercase letters are invalid). The number of drinks for all three sizes is greater than or equal to zero. (all If the orders list is empty, the function should simply return 0.0 Examples: ordersl-'P', 5, 0, 411 orders3-'G.4. 3, 2, ['S', 0, , 101, ',1. 4. 311 Function cafe.day (ordersl) 18.75 cafe.day (orders2) 39.95 cafe.day (orders3) 49 Value

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Understand how customers respond to effective service recovery.

Answered: 1 week ago