Newbee Question

Shawn Milochik Shawn at Milochik.com
Mon Aug 20 10:55:25 EDT 2007


#!/usr/bin/env python

normalPay = 0.4
overPay = 1.4
normalLimit = 22

def calcPay(numStops):

    pay = 0

    if numStops > normalLimit:
        pay = overPay * (numStops - normalLimit)
        numStops = normalLimit

    return pay + (numStops * normalPay)

if __name__ == "__main__":

    print "Pay for 1 stops: %.2f." % calcPay(1)
    print "Pay for 10 stops: %.2f." % calcPay(10)
    print "Pay for 17 stops: %.2f." % calcPay(17)
    print "Pay for 25 stops: %.2f." % calcPay(25)
    print "Pay for 30 stops: %.2f." % calcPay(30)
    print "Pay for 31 stops: %.2f." % calcPay(31)



More information about the Python-list mailing list