Last active
March 21, 2022 15:20
-
-
Save shaikkhajaibrahim/ce2e447c52b78782b8e8394ecd87b505 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def calculate_monthly_installment( | |
principal, | |
rate_of_intrest, | |
duration, | |
processing_fee_percent=0): | |
""" | |
This method should calculate monthly installment | |
params: | |
prinicpal: Amount of the product purchased | |
rate_of_intrest: rate of interest (10.5 => 0.105) | |
duration: duration in months | |
processing_fee_percent: processing fee percent default is zero | |
Returns: | |
monthly installment | |
""" | |
rate_of_intrest_pm= rate_of_intrest/12 | |
emi = principal * rate_of_intrest_pm * ((1 + rate_of_intrest_pm)**duration)/((1 + rate_of_intrest_pm)**duration-1) | |
return emi | |
if __name__ == '__main__': | |
print(calculate_monthly_installment( | |
principal=100000, | |
rate_of_intrest=0.065, | |
duration=60)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment