# tpm.py
# A program that accepts the total amount of purchase, calculates the
# appropriate discount, and displays the discount and the purchase after
# discount.

from math import *

def main():
cost = get_cost()
discount = get_discount()
% = calc_percent(discount)
final cost = get_final_cost
cost_percent = cost_discount(cost, discount)

def get_cost():
return float(raw_input("Enter the cost before discount: "))

def get_discount():
return float(raw_input("Enter your discount is: "))

def calc_percent(discount)
% = 0.10 on the entire purchase if it exceeds $1,000.00
% = 0.05 on the entire purchase if it exceeds $500.00, but not $1,000.00
print "No discount on puchases of $500.00 or less


Since your discount is calculated from the total purchase, you do not need to ask for it.
Discount calculations are done using conditional if statements.

Do not use % as a variable name!

All calculations are simple, no need for "from math import *"

You are almost there, please try to understand the logic here ...

def calc_discount(cost):
    if cost > 1000.00:
        discount = cost * 0.1    # 10%
        return discount
    elif cost > 500.00:
        discount = cost * 0.05   # 5%
        return discount
        # no discount
        return 0.0

Once you know the cost of the purchase then discount = calc_discount(cost) and your final cost will be cost - discount. Not really rocket science, but very simple algebra!

This question has already been answered. Start a new discussion instead.