Skip to content

Instantly share code, notes, and snippets.

@ebovio
Created April 16, 2017 19:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ebovio/de67068e8ba3ec3345e390e36e4e595e to your computer and use it in GitHub Desktop.
Save ebovio/de67068e8ba3ec3345e390e36e4e595e to your computer and use it in GitHub Desktop.
#Program8
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 number:"))
print("The babilonian square root of the number you provided is", sqrt(w))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment