Created
March 30, 2017 16:28
-
-
Save ebovio/964ad669084bdebce0ce59124026e7b0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def sqrt(x, eps=1e-6): | |
r = x * 1 | |
while abs(x - r * r) > eps: | |
r = 0.5 * (r + x / r) | |
return r | |
#Main program below | |
w=float(input("Write the first number")) | |
print(sqrt(w)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment