forked from kishanrajput23/Java-Projects-Collections
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathComputeLoan.py
More file actions
20 lines (16 loc) · 707 Bytes
/
ComputeLoan.py
File metadata and controls
20 lines (16 loc) · 707 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# Enter yearly interest rate
annualInterestRate = eval(input(
"Enter annual interest rate, e.g., 8.25: "))
monthlyInterestRate = annualInterestRate / 1200
# Enter number of years
numberOfYears = eval(input(
"Enter number of years as an integer, e.g., 5: "))
# Enter loan amount
loanAmount = eval(input("Enter loan amount, e.g., 120000.95: "))
# Calculate payment
monthlyPayment = loanAmount * monthlyInterestRate / (1
- 1 / (1 + monthlyInterestRate) ** (numberOfYears * 12))
totalPayment = monthlyPayment * numberOfYears * 12
# Display results
print("The monthly payment is", int(monthlyPayment * 100) / 100)
print("The total payment is", int(totalPayment * 100) /100)