#!/usr/bin/python3 # -*- coding: utf-8 -*- import math import numpy def sqare_rt(my_val: float) -> float: diff: float = 1.0 root: float = 1.0 while (diff > 0.0001) or (diff < -0.0001): root = (root + (my_val / root)) / 2.0 diff = (root * root) - my_val return root twenty: float = 20.0 # Our version: print(sqare_rt(20.0)) # Versus python's: print(math.sqrt(20.0)) # Versus numpy's print(numpy.sqrt(20.0))