def my_sqrt(num, epsilon=1e-6, maxiter=1e6):
    """Return square root of num using Newton Raphson method"""
    x0, x1 = 0, 1
    cnt = 0
    while abs(x1 - x0) > epsilon: 
        x0, x1 = x1, 0.5*(x1 + num/x1)
        cnt += 1
        if cnt == maxiter: raise Exception("Max iteration reached")
    return x1