Python Assignment Exercise 7: Write a program called mortgageCalculator.py. Crea
ID: 3812316 • Letter: P
Question
Python Assignment
Exercise 7: Write a program called mortgageCalculator.py. Create a mortgage calculator. It should calculate mortgage payments and total mortgage cost. Users will enter the following: The amount of money borrowed (principal) The duration of the loan in years (years) The annual percentage rate for the loan (apr) The number of payments made so far (paidPayments) The program will calculate: Total number of payments (totalPayments) Monthly payment amount (payment) Total cost for the loan (totalCost) Total interest (totallnterest) Outstanding principal (outstanding) Amount paid so far (paid) It should format the output so it looks something like this: Total loan $250000.00 Interest- 3.35% Years 15 Number of payments 180 Payment amount 1768 4/5Explanation / Answer
borrowed_amount = input("Enter the amount of money borrowed (principal): ")
borrowed_amount = int(borrowed_amount)
duration_years = input("Enter the duration of the loan in years (years): ")
duration_years = int(duration_years)
annual_percentage = input("Enter the annual percentage rate for the loan (apr): ")
annual_percentage = float(annual_percentage)
number_of_payments = input("Enter the number of payments made so far (PaidPayments): ")
number_of_payments = int(number_of_payments)
total_number_of_payments = duration_years*12
temp = (borrowed_amount*duration_years)
total_interest = (temp*annual_percentage)/100
total_loan_cost = total_interest + borrowed_amount
monthly_payment = (total_loan_cost)/total_number_of_payments
amount_paid_so_far = number_of_payments * monthly_payment
print("total_number_of_payments :",total_number_of_payments )
print("total_interest :",total_interest )
print("total_loan_cost :",total_loan_cost )
print("monthly_payment :",monthly_payment )
print("amount_paid_so_far :",amount_paid_so_far )
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.