Skip to content

Commit 64210dc

Browse files
Merge pull request souravjain540#143 from abhimanyus1997/main
Created EMI Calculator
2 parents 67d5bfb + 7ef964c commit 64210dc

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

emi-calculator.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
def emi_calculator(p:float, r:float, t:float):
2+
"""EMI Calculator for one months
3+
--------------------------------
4+
Parameters:
5+
p - principal
6+
r - interest rate per month
7+
t - time period (in years)
8+
"""
9+
r = r / (12 * 100) # one month interest
10+
t = t * 12 # one month period
11+
emi = (p * r * pow(1 + r, t)) / (pow(1 + r, t) - 1)
12+
return emi
13+
14+
15+
principal = float(input("Enter principal amount (in ₹):"))
16+
rate = float(input("Enter Interest Rate per month (%):"))
17+
time = float(input("Enter Time period (in years):"))
18+
emi = emi_calculator(principal, rate, time)
19+
print("Your Monthly EMI is ₹", round(emi,2))
20+

0 commit comments

Comments
 (0)