Question: In python Write a function cafe.day that which takes one argument, orders, which is a list of drink orders for the day at a caf.


In python
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. CSE 101-Fall 2017 Lab #5 Page 3 3. 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 floating-point number that represents the revenue generated for the day in dollars. Don't round the return value! The s for different sizes are as follows: Drink Size Price 3.50 Medium 2.50 ma In addition, there will be different privileges depending on different memberships, as described below: Membership Privilege Platinum If the customer purchases 3 or more l gets at most 3 free small drinks. If the customer purchases at least 10 drinks (in any combination of small, medium and large) then he/she gets e drinks, OR 4 or more medium drinks, then he/she Gold a 20% discount. ilver customer receives 2% off price rega nun 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. 'G' or S' (all The first element in the sub-list, which is the membership, is one of the three strings'P lowercase letters are invalid). . The number of drinks for all three sizes is greater than or equal to zero. If the orders list is empty, the function should simply return 0.0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
