File size: 212 Bytes
e93c178
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
def calculate_emi(principal, rate, tenure_years):
    r = rate / (12 * 100)
    n = tenure_years * 12

    if n == 0:
        return 0

    emi = (principal * r * (1 + r) ** n) / ((1 + r) ** n - 1)
    return emi