I need to do a "quantity()" función, which receives the total to be a paid and the amount the customer pays... | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I need to do a "quantity()" función, which receives the total to be a paid and the amount the customer pays...

I need to do a "quantity()" función, which receives the total to be a paid and the amount the customer pays with and returns the amount to be returned to the customer. But the problem is that I cannot use iteration, it must be with tail recursion, if someone could help me I will appreciate it The problem is: A company wants to automate the purchase service of a store. To do this, you want to create a machine that calculates the amount of the product purchased and must give the return Yn the most optimal way possible. Being in Costa Rica, the following coins and bills are appreciated funcion (total, may) tharecive two integers that mean the total purchase and how much the customer pays. The función must return a list with pairs indicating the ticket and its amount. It is expected that the least amount of bills and coins will be used, for example, if there are 5000 that you most return, you should use 1 ticket of 5000 and not 5 of 1000.

25th Jun 2020, 11:43 PM
Marco Agüero
Marco Agüero - avatar
1 Answer
0
def quantity (total,cpays): if total <= cpays: return cpays - total else : print("amount not enough ") cpays = int(input()) quantity (total,cpays)
26th Jun 2020, 1:34 AM
uday kiran
uday kiran - avatar