Question
Programming Exercise 3.10 The credit plan at TidBit Computer Store specifies a 10% down payment and an annual interest rate of 12%. Monthly payments are
Programming Exercise 3.10
The credit plan at TidBit Computer Store specifies a 10% down payment and an annual interest rate of 12%. Monthly payments are 5% of the listed purchase price, minus the down payment.
Write a program 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.
----------------------------------------------------------------------------------------------------------------------------------------
Hello, I need help trying to figure out why my python won't run, and I keep getting this error saying :
File "/root/sandbox/tidbit.py", line 19 print(" %s%19s%18s%19s%10s%17s") % ("Month", "Starting Balnce", "Interest to pay", "principal to pay,"payment","endingBalance")) ^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: invalid syntax. Perhaps you forgot a comma?
(*At the bottom is what I typed into python and it seemed no matter what I did, I cannot get a score or submission in *) I am new to this, and yet I was feeling exhausted because I tried to run this and it's not running been on this ALL DAY. Can you help me identify and solve the solution? It would be much appreciated because I am struggling. Thank you, and God Bless.
--------------------------------------------------------------------------------------------------------------------------------------
# Constants declaration
DOWN_PAYMENT_RATE = 0.10
ANNUAL_INTEREST_RATE = 0.12
MONTHLY_PAYMENTS_RATE = 0.05
# prompt the user to enter the purchase price
purchasePrice = float(input(" Enter the purchase price:"))
# The month number (beginning with 1 )
month = 1
# The payment for that month
payment = purchasePrice * MONTHLY_PAYMENTS_RATE
# The current total balance owed
startingBalance = purchasePrice
#print the table heading
print(" %s%19s%18s%19s%10s%17s" % ("Month", "Starting Balnce", "Interest to pay", "principal to pay,"payment","endingBalance"))
# repeat the loop as long as the startingBalance is greater than 0
while startingBalance > 0:
# The interest owed for that month
interestToPay = startingBalance * ANNUAL_INTEREST_RATE / 12
# The amount of principal owed for that month
principalToPay = payment - interestToPay
# The balance remaining after payment
endingBalance = startingBalance - payment
# print the statistics
print("2d%15.2f%16.2f%18.2f%18.2f%15.2f" % ("month", "startingBalance", "interestToPay, "principalToPay", "payment", "endingBalance"))
# update the starting balance
startingBalance = eheading
#increment the month by 1
month = month + 1
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started