Question
develop python program 4. Variable Drink Pricing (5 points) Variables, a new bar, has a very unusual pricing policy for the two drinks that it
develop python program
4. Variable Drink Pricing (5 points) Variables, a new bar, has a very unusual pricing policy for the two drinks that it sells (called A and B here for simplicity). At the start of each night, each drink costs $5. Each time a drink is purchased, its price goes up $1 for the next patron (the prices change independently; if someone purchases drink A, its price goes up but the price for B stays the same). In order to prevent prices from getting too high, a drink's price cannot exceed $11; after a drink is sold for $11, its price resets back to $5 and begins to rise again. For example, suppose several drinks are purchased in the following order: A, A, A, B, B, A, B. The corresponding prices for these drinks (in order) would be $5, $6, $7, $5, $6, $8, $7. Complete the drinkBill() function, takes a string representing a sequence of drink orders from the user (as a series of capital As and Bs, with no spaces or other characters present). Your function should calculate and return the total cost of all the drinks sold (in the example above, the total cost would be $44, so your function would return 44). You may assume that the input will only contain uppercase As and Bs.
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