Please send questions to
st10@humboldt.edu .
from profit_ex import *
# contract: diff_profits2: void -> void
# purpose: to ask the user for the ticket price range
# and price increment, and then print to
# the screen the profits for all prices
# in that range inclusive in the form of
# a simple table.
# example: not really applicable; this simply
# asks the user for ticket price range and
# increment, and
# prints the profits for these ticket
# prices to the screen
def diff_profits3():
# ask for the ticket price range and increment
start_price_str = raw_input("Type the starting\n ticket price: ")
end_price_str = raw_input("Type the ending ticket price: ")
price_increment_str = raw_input("Type the desired price increment: ")
start_price = float(start_price_str)
end_price = float(end_price_str)
price_increment = float(price_increment_str)
# print out a header
print ""
print "Ticket price\tprofit" # \t is a tab character
print "------------\t------"
# print out all the profits for ticket prices in the range
# the user specified
curr_price = start_price
while (curr_price <= end_price):
print "$" + str(curr_price) + "\t\t$" + str( profit(curr_price) )
curr_price = curr_price + price_increment2