Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

try and exception

def loan_emi(amount, duration, rate, down_payment=0):
    loan_amount = amount - down_payment
    try:
        emi = loan_amount * rate * ((1+rate)**duration) / (((1+rate)**duration)-1)
    except ZeroDivisionError:
        emi = loan_amount / duration
    emi = math.ceil(emi)
    return emi
Source by hub.binder.jovian.ai #
 
PREVIOUS NEXT
Tagged: #exception
ADD COMMENT
Topic
Name
8+8 =