My question is posted in the photos and what I have is also a photo attachment. I need a basic python code that uses //, % and / and can compute the “ACTUAL OUTPUT” Do not need a complex code



program:-
import sys
#taking input
TotalAmount=input("Enter total cost of purchase: ")
GivenCash=input("Enter Amount paid: ")
TotalAmount=round(float(TotalAmount),2)
GivenCash=round(float(GivenCash),2)
if float(TotalAmount)>float(GivenCash):
sys.exit("Did not receive enough cash from the customer.")
#spliting money into bills and coins
TotalBills,TotalCoins=map(int,str(TotalAmount).split("."))
GivenBills,GivenCoins=map(int,str(GivenCash).split("."))
#get the actual amount which needs to be break down into bills and coins
TotalBills=GivenBills-TotalBills
TotalCoins=GivenCoins-TotalCoins
#if there are no enough
if TotalCoins<0:
TotalCoins=100+TotalCoins #used plus because Total coins is in negitive value
TotalBills-=1
#stored bill and coin amounts
bills=[20,10,5,1]
coins=[25,10,5,1]
#to store number of bills and coins
ReturnBills=[0,0,0,0]
ReturnCoins=[0,0,0,0]
'''
for first loop it divided Total bills with 20(it is at first index)
adds that to returnbills[0]
then TotalBills=TotalBills%bills[i] places the remaninder when 20 is divide total amount
this is repeated for all bills
same for coins too
'''
for i in range(4):
ReturnBills[i]=TotalBills//bills[i]
TotalBills=TotalBills%bills[i]
ReturnCoins[i]=TotalCoins//coins[i]
TotalCoins=TotalCoins%coins[i]
#printing
print("Please to return")
if ReturnBills[0]>0:
print(ReturnBills[0]," twenties bills")
if ReturnBills[1]>0:
print(ReturnBills[1]," tens bills")
if ReturnBills[2]>0:
print(ReturnBills[2]," fives bills")
if ReturnBills[3]>0:
print(ReturnBills[3]," ones bills")
if ReturnCoins[0]>0:
print(ReturnCoins[0]," quarters")
if ReturnCoins[1]>0:
print(ReturnCoins[1]," dimes")
if ReturnCoins[2]>0:
print(ReturnCoins[2]," nickels")
if ReturnCoins[3]>0:
print(ReturnCoins[3]," pennies")
Step by step
Solved in 2 steps









