#I'm taking this intro to Python class and I cant seem to keep it down. Right now I'm having trouble passing values and I was #wondering if anyone could help me out.
#This is what I'm working on
#Do I want to put item_total in display_results() like (display_results(item_total)) or am I way off?
#This is what I'm working on
Code:
DISCOUNT_RATE = 0.05
#
SALES_TAX_RATE = 0.06
def display_message():
print"""
___________________________
|Five values are displayed|
| |
|Item total |
|Discount amount |
|Amount due after discount|
|Sales tax |
|And |
|Total amount due |
---------------------------
"""
display_message()
def main():
unit_price = input ("Input the products price: ")
number_of_units = input ("Input number of products being purchased: ")
item_total = unit_price * number_of_units
discount_amount = item_total * DISCOUNT_RATE
total_after_discount = item_total - discount_amount
sales_tax_due = total_after_discount * SALES_TAX_RATE
total_amount_due = total_after_discount + sales_tax_due
def display_results():
print
print "__________________________________"
print "Item total: ", '$%3.2f' %item_total, "|"
print "----------------------------------"
print
print "__________________________________"
print "Discount amount: ", '$%3.2f' %discount_amount, "|"
print "----------------------------------"
print
print "__________________________________"
print "Total after discount: ",'$%3.2f' %total_after_discount, "|"
print "----------------------------------"
print
print "__________________________________"
print "Sales tax due: ", '$%3.2f' %sales_tax_due, "|"
print "----------------------------------"
print
print "__________________________________"
print "Total amount due: ", '$%3.2f' %total_amount_due, "|"
print "----------------------------------"
main()
display_results()
#Do I want to put item_total in display_results() like (display_results(item_total)) or am I way off?