Hello, I've been having an issue with a program that I'm writing. The program works until it has to compute something:
def carPmt(): cost = requestInteger("How much does the car cost?") downPmt = requestInteger("If there is a down payment, how much?") tradeIn = requestInteger("If there is a trade-in, what is its value?") years = requestInteger("How many years will you be paying?") air = requestInteger("What is the interest rate?") payment = calculatePayment(cost,downPmt,tradeIn,years,air) print "With a down payment of",downPmt," a trade-in value of",tradeIn, print ", an annual interest rate of",air,", your new",cost, "car will cost", print "you only",payment, "per month." def calculatePayment(cost,downPmt,tradeIn,years,air): carCostInitial = cost - downPmt carCostIntermediate = carCostInitial - tradeIn monIntRate = air/12 compoundingFactor = (1.0+monIntRate)**12.0/(1+monIntRate**12.0)-1.0 monthPmt = monIntRate*carCostIntermediate*compoundingFactor return monthPmt The first two sections work; the third one does not. When inputting random values, I get this: "With a down payment of 5000 ,a trade-in value of 7000 ,an annual interest rate of 2 ,your new 25000 car will cost you only 0.0 per month" Obviously I don't want my answer to be 0.0. I've had other people look at it (although they aren't well-versed in Python) and they couldn't help me isolate the problem. Thanks a million. Siobhan Wojcik
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor