Please send questions to
st10@humboldt.edu .
from profit_ex import *
# contract: diff_profits2: void -> void
# purpose: to print the profits for ticket
# prices in the range [1.0, 7.0],
# in dime increments in the form of a simple table
# example: not really applicable; this simply
# prints the profits for these ticket
# prices to the screen
def diff_profits2():
# print out a header
print ""
print "Ticket price\tprofit" # \t is a tab character
print "------------\t------"
# print out all the profits for ticket prices from $1 to $7
# in dime increments
START_PRICE = 1.0
END_PRICE = 7.0
PRICE_INCREMENT = 0.1
curr_price = START_PRICE
while (curr_price <= END_PRICE):
print "$" + str(curr_price) + "\t\t$" + str( profit(curr_price) )
curr_price = curr_price + PRICE_INCREMENT