Skip to content

Instantly share code, notes, and snippets.

@shaikkhajaibrahim
Last active March 21, 2022 15:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shaikkhajaibrahim/ce2e447c52b78782b8e8394ecd87b505 to your computer and use it in GitHub Desktop.
Save shaikkhajaibrahim/ce2e447c52b78782b8e8394ecd87b505 to your computer and use it in GitHub Desktop.
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