Home / Expert Answers / Computer Science / my-code-is-giving-the-wrong-answer-code-answer-1-720-00-7-20-28-80-36-00-691-20-correct-answ-pa168

(Solved): My code is giving the wrong answer: Code answer: 1 720.00 7.20 28.80 36.00 691.20 Correct answ ...



My code is giving the wrong answer: Code answer: 1 720.00 7.20 28.80 36.00 691.20 Correct answer: 1 720.00 7.20 32.80 40.00 680.00 Prompt: Write a program in the file tidbit.py that takes the purchase price as input. The program should display a table, with appropriate headers, of a payment schedule for the lifetime of the loan. Each row of the table should contain the following items: the month number (beginning with 1) the current total balance owed the interest owed for that month the amount of principal owed for that month the payment for that month the balance remaining after payment The amount of interest for a month is equal to balance * rate / 12. The amount of principal for a month is equal to the monthly payment minus the interest owed. (LO: 3.2, 3.3, 3.4) My Cod# Request the inputs and convert values downPayment = 0.10 annualInterest = 0.12 paymentPercentage = 0.05 purchasePrice = float(input("Enter the purchase price: ")) # calculate starting, monthly interest, and payment startingBalance = purchasePrice * (1 - downPayment) interestRate = annualInterest / 12 payment = startingBalance * paymentPercentage month = 1 print() # display the header print("%7s %18s %17s %18s %9s %16s" % ("Month", "Starting Balance", "Interest to Pay", "Principal to Pay", "Payment", "Ending Balance")) # compute and display results while startingBalance > 0: interest = startingBalance * interestRate if payment > startingBalance + interest: payment = startingBalance + interest principal = payment - interest endingBalance = startingBalance - principal print("%5d %15.2f %16.2f %18.2f %14.2f %17.2f" % (month, startingBalance, interest, principal, payment, endingBalance)) startingBalance = endingBalance month += 1e:



We have an Answer from Expert

View Expert Answer

Expert Answer


We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe