Python Help
python help
Python help needed - Python
I've been trying to make a cash register program and right now this is my draft. For the program, the prices need to add up to a total which than will be calculated with HST and discount amounts. The discount needs to be the lowest number price entered from all the prices, however lowest number won't work and instead will be saved as the highest number.-num is total price
-price is self explanatory
-lowest is used to store the lowest number
-HST is the tax
-items is the total amount of items
Learn more
Mark Lutz
num=0
price=0
lowest=0
HST=0.13
items=0
print "Enter 0 to print receipt.\n-----------------------"
while price>0:
price=raw_input("Enter your price here: $")
price=float(price)
num=num+price#num is the subtotal
print "tag2"
while price<0:
print "Invalid number"
price=raw_input("Enter your price here $")
price=float(price)
num=price+num
print "tag 3"
Learn more
John Zelle
if (price>0):
if (lowest<=price):
lowest=price
print "tag6"
items=items+1 #total amount of items
print "Subtotal: " ,num
print "Discount: " ,lowest
print "After discount: " ,num-lowest
print "HST: " ,(num-lowest)*HST
print "Total: " ,(num-lowest)+((num-lowest)*HST)
print "-----------------------"
print "tag4"
0 コメント:
コメントを投稿