Please send questions to
st10@humboldt.edu .
# contract: event1: void -> void
# purpose: is to ask the user for a ticket price, and
# determine and print to the screen how many performances
# it would take to get to 500 attendees at that ticket price
# example: if when you run event1() you enter a
# ticket price of 5, then the following
# should be printed to the screen:
# It will take 5 performances to get to at least 500 attendees
# if whe you run event1() you enter a ticket price of 7,
# then the following should be printed to the screen:
# You'll never get there! Negative attendance!
from profit_ex import *
DESIRED_ATT_TOTAL = 500
def event1():
# get desired ticket price from user
ticket_price = float( raw_input("What is the desired ticket price? "))
# initialize needed variables
# num_performances, total_attendees
num_performances = 0
total_attendees = 0
# find out how many attendees per performance at
# this ticket price
attendees_per_perf = attendance(ticket_price)
# determine how many performances it take
if (attendees_per_perf <= 0):
print "You'll never get there! Negative attendance!"
else:
while total_attendees < DESIRED_ATT_TOTAL:
num_performances = num_performances + 1
total_attendees = total_attendees + attendees_per_perf
# print out the final num_performances
print ("It will take " + str(num_performances) +
" performances to get to at least " +
str(DESIRED_ATT_TOTAL) + " attendees")