0% found this document useful (0 votes)
36 views2 pages

Computer Programming Laboratory 2

phython programming codes

Uploaded by

Sandra Gonzales
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views2 pages

Computer Programming Laboratory 2

phython programming codes

Uploaded by

Sandra Gonzales
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Computer Programming Laboratory 2

print("Total Purchase")
prices={
"egg":5,
"loaf bread":70,
"coffee":10,
"apple":30,
"yogurt":44.20
}
purchase={
"egg":12,
"loaf bread":1,
"coffee":10,
"apple":3,
"yogurt":2,
}
sales_tax=0.06
subtotal=0
for x in prices:
subtotal=subtotal+prices[x]*purchase[x]
total_sales_tax=subtotal*sales_tax
total=subtotal+total_sales_tax
print("subtotal:")
print(subtotal)
print("total_sales_tax:")
print(total_sales_tax)
print("total amount after tax:")
print(total)

print("Tip, Tax and Total")


Name=input("enter name:")
charge_for_food = float(input('\nEnter charge for food: P'))
TIP_PERCENTAGE = .18
SALES_TAX = .1
tip = (charge_for_food * TIP_PERCENTAGE)
sales_tax = (charge_for_food * SALES_TAX)
grand_total = charge_for_food + tip + sales_tax
print("Name:"+Name)
print('\nCharge for food = P', format(charge_for_food, ',.2f'), sep='')
print('Tip = P', format(tip, ',.2f'), sep='')
print('Sales tax = P', format(sales_tax, ',.2f'), sep='')
print('Grand total = P', format(grand_total, ',.2f'), sep='', end='\n\n')

You might also like