Newbee Question
Asun Friere
afriere at yahoo.co.uk
Tue Aug 21 03:41:59 EDT 2007
Oh well since a few solutions have already been posted I thought I
might add another, just so you at the very least you have to do some
work making up your mind which one to choose. Using an incremental
approach just to be different ...
from decimal import Decimal
normal = Decimal('0.04')
over = Decimal('1.40)
def calcStopPay (stops) :
pay = Decimal('0.00')
while stops :
incr = normal if stops < 23 else over
pay += incr
stops -= 1
return pay
#testing:
for x in range(50) :
print "Stop pay for %s stops: $%s" % (x, calcStopPay(x))
More information about the Python-list
mailing list