Assignment 1
Assignment 1
Date: 20-12-2022
1. Car loans are a type of amortizing loan. Let’s say you took out an auto loan for
$20,000
with an APR(Annual Percentage Rate) of 6 percent and a five-year repayment
timeline.
Here’s how you would calculate loan interest payments.
Divide the interest rate you’re being charged by the number of payments you’ll
make each year, usually 12 months.
Multiply that figure by the initial balance of your loan, which should start at the
full amount you borrowed.
For the figures above, the loan payment formula would look like:
0.06 divided by 12 = 0.005 (Monthly Interest Rate)
0.005 x $20,000 = $100 (Monthly Interest Amount)
That $100 will be the interest paid in the first month. However, as you continue to
pay
your loan off, more of your payment goes toward the principal balance and less
toward
interest. Display each month’s interest payment by doing the same math shown
above
using your new, lower loan balance.
Write a python program that lets the user enter the loan amount, APR
and loan period
in number of years and displays the monthly and total payments for first year
alone.
Hint: To calculate a monthly interest rate, divide the annual rate by 12 to reflect
the 12 months
in the year.
While calculating the Monthly payment, kindly ensure the decimal places to be at
least 5
precisions. If so, then you will get the following output.
Here is a sample run:
Paying off an amortizing loan
$19,713
Month 1 $20,000 $386.66 $286.66 $100.00
.34
$386.6 $19,425.
Month 2 $19,713.34 $288.09 $98.57
6 25
$386.6 $19,135.
Month 3 $19,425.25 $289.53 $97.13
6 72
$386.6 $18,844.
Month 4 $19,135.72 $290.98 $95.68
6 75
$386.6 $18,552.
Month 5 $18,844.75 $292.43 $94.22
6 32
$386.6 $18,258.
Month 6 $18,552.32 $293.89 $92.76
6 42
$386.6 $17,963.
Month 7 $18,258.42 $295.36 $91.29
6 06
$386.6 $17,367.
Month 9 $17,666.22 $298.32 $88.33
6 89
monthlyInterestRate = (apr/100) / 12
print(8 * " " + "Loan balance Monthly Payment Paid toward Principal Paid
toward interest New loan balance")
for i in range(12):
loanAmount -= paidTowardPrincipal
totalPayment = monthlyPayment * 12
Output:
Loan balance Monthly Payment Paid toward Principal Paid toward interest
New loan balance