# This program prompts for information about a # loan and computes the monthly mortgage payment. def main(): # obtain values print("Monthly Mortgage Payment Calculator") loan = float(input("Loan amount? ")) years = int(input("Number of years? ")) rate = float(input("Interest rate? ")) # compute payment result n = 12 * years c = rate / 12.0 / 100.0 payment = loan * c * (1 + c) ** n / ((1 + c) ** n - 1) # report result to user print() print("Monthly payment is: $", round(payment, 2)) main()