Answered step by step
Verified Expert Solution
Question
1 Approved Answer
details and explanation plz In Doesntexistland, soda pop stores refund soda pop bottles as an environmental initiative. However, the store will only exchange a certain
details and explanation plz
In Doesntexistland, soda pop stores refund soda pop bottles as an environmental initiative. However, the store will only exchange a certain number of bottles at a time. If a person has a certain amount of money to start with, how many bottles of soda pop can they purchase, given the price of soda pop, and the current exchange rate? You must write a recursive function in Python lightning Bottle which simulates multiple trips to the soda pop store. Your function must take money -> the amount of money the customer has bottles Owned -> the number of bottles the customer has to exchange price -> the price of a bottle of soda pop exchange Rate -> the exchange rate, expressed as a tuple, the first element is the minimum size of the group of bottles that can be exchanged. The second argument is the refund received for one group of bottles. A customer may refund as many groups of bottles as they like on a single visit to the store, but the total number of bottles refunded must be a multiple of the first element of exchangeRate. The function must output the total number of bottles which the customer is able to purchase over all trips, until the customer runs out of money. McMaster University and the student success team behind CS 1MD3 do not in any way endorse the drinking of soda pop. Always drink sugary beverages responsibly. [ ]: # Write your answer here. def lightningBottle (money, bottlesOwned, price, exchangeRate): return [ ]: # Explanation: # With $11, 3 bottles can be purchased. 2 of those bottles can be returned for $1, Leaving remainder/carryover at $3 and 1 bottle if lightningBottle(11,0,3,(2,1)) == 5: print("Test case 1 passed") if(lightningBottle (49,0,3,(3,2)) == 22): print("Test case 2 passed") if(lightningBottle (99,0,4,(7,1)) == 28): print("Test case 3 passed") In Doesntexistland, soda pop stores refund soda pop bottles as an environmental initiative. However, the store will only exchange a certain number of bottles at a time. If a person has a certain amount of money to start with, how many bottles of soda pop can they purchase, given the price of soda pop, and the current exchange rate? You must write a recursive function in Python lightning Bottle which simulates multiple trips to the soda pop store. Your function must take money -> the amount of money the customer has bottles Owned -> the number of bottles the customer has to exchange price -> the price of a bottle of soda pop exchange Rate -> the exchange rate, expressed as a tuple, the first element is the minimum size of the group of bottles that can be exchanged. The second argument is the refund received for one group of bottles. A customer may refund as many groups of bottles as they like on a single visit to the store, but the total number of bottles refunded must be a multiple of the first element of exchangeRate. The function must output the total number of bottles which the customer is able to purchase over all trips, until the customer runs out of money. McMaster University and the student success team behind CS 1MD3 do not in any way endorse the drinking of soda pop. Always drink sugary beverages responsibly. [ ]: # Write your answer here. def lightningBottle (money, bottlesOwned, price, exchangeRate): return [ ]: # Explanation: # With $11, 3 bottles can be purchased. 2 of those bottles can be returned for $1, Leaving remainder/carryover at $3 and 1 bottle if lightningBottle(11,0,3,(2,1)) == 5: print("Test case 1 passed") if(lightningBottle (49,0,3,(3,2)) == 22): print("Test case 2 passed") if(lightningBottle (99,0,4,(7,1)) == 28): print("Test case 3 passed")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