# Insurance.py # # This program is a reporting tool used each week to determine # which members of "the Family" deserve praise and who needs some # "encouragement." # # When the program runs, it asks for the names of all of the "salesmen" # and the amounts of "insurance premiums" they have collected. After the # last associate has been processed, the user enters "RIP" for the name, and # the program reports the maximum, minimum values and associates who attained them. # # Programmer: Garry Gambino # def insurance ( ): maxAmt = 0.0 minAmt = 999999999.99 maxCollector = "No one" minCollector = "No one" report = "\n\n\n==== The Family Insurance Winner and Loser Report ====\n\n" nextCollector = raw_input ("Enter name of next associate: ") while nextCollector != "RIP": nextAmt = input ("Enter amount collected by " + nextCollector + ": " ) if nextAmt > maxAmt: # this is the new max maxAmt = nextAmt maxCollector = nextCollector if nextAmt < minAmt: # this is the new min minAmt = nextAmt minCollector = nextCollector # add to the report report = report + nextCollector + "\t$ %10.2f"%nextAmt + "\n" nextCollector = raw_input ("Enter name of next associate: ") # end while print report print "\n\nThis week's winner is " + maxCollector + \ " who collected $ %8.2f"%maxAmt + " in premiums\n" print "This week's loser is " + minCollector + \ " who only collected $ %8.2f"%minAmt + " in premiums", if minAmt < maxAmt * .4: print "--We'll miss him.\n\n" else: print "--We hope he does better next time!" insurance( )