Pleas help with PYTHON program. Write a program that let\'s the user enter the l
ID: 3804298 • Letter: P
Question
Pleas help with PYTHON program. Write a program that let's the user enter the loan amount and loan period in number of years and displays the monthly total payments for each interest rate starting from 5% to 8%, with an increment of 1/8. **Using Loops**
oops Loan Amount: 10000 Enter Number of Years: 5 Enter Interest Rate Monthly Payment Total Payment 5000% 18871 11322·74 5. 125% 189.28 11357.13 5.250% 11391.59 7875% 20217 12129.97 202 . 76 12165.83 a 439 73 P 715 98 727-95 a 259 26 t 333 11 0111 22 y te 7185 76 E 728 17 17 n 899 22 o 888 00 05M11-22 Os 1r ae : et tYa o ot Are %%% %% er 050 50 n be 02 570 a mt 012 .80 o un LN- 555 ¥78 SExplanation / Answer
Answer:
def get_monthly_payment(principal, annual_rate, years):
while(annual_rate <= 8):
monthly_rate = annual_rate / 100 / 12
monthly_payment = principal * (monthly_rate + monthly_rate / ((1 + monthly_rate) ** (12 * years) - 1))
total = (monthly_payment * 5 * 12 )
print( '%f %f %f' % (annual_rate, abs(monthly_payment), abs(total)))
annual_rate = annual_rate + 0.125
return monthly_payment
principal = float((input('Loan Amount:')))
years = float((input('Number of years:')))
annual_rate = float(5)
print("Intrest Rate Monthly rate Total payment")
print (get_monthly_payment(principal, annual_rate, years))
Output:
Loan Amount:10000
Number of years:5
Intrest Rate Monthly rate Total payment
5.000000 188.712336 11322.740186
5.125000 189.285552 11357.133121
5.250000 189.859838 11391.590306
5.375000 190.435195 11426.111710
5.500000 191.011622 11460.697303
5.625000 191.589118 11495.347052
5.750000 192.167682 11530.060926
5.875000 192.747315 11564.838893
6.000000 193.328015 11599.680918
6.125000 193.909783 11634.586968