Learn practical skills, build real-world projects, and advance your career
import math
help(math.ceil)
Help on built-in function ceil in module math: ceil(x, /) Return the ceiling of x as an Integral. This is the smallest integer >= x.
math.ceil(1.2)
2
try:
    print("Now computing the result..")
    result = 5/0
    print("Computation was completed successfully")
except ZeroDivisionError:
    print("Failed to compute result because you were trying to divide by zero")
    result = None
    print(result)
Now computing the result.. Failed to compute result because you were trying to divide by zero None
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