Created
March 30, 2017 23:01
-
-
Save hector117/9defc2636f27e9c26135952ebd743871 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 Babilonia(n): | |
a = n | |
b = 0 | |
while b > (n-.00001) or b < (n+.00001): | |
a = n/a | |
b = a*a | |
if b > (n-.00001) and b < (n+.00001): | |
return a | |
else: | |
a = (n/a+a)/2 | |
b = a*a | |
return a | |
#main program below | |
print("WSQ-10") | |
n = float(input("Ingresa un número ")) | |
f = Babilonia(n) | |
print("La raíz cuadrada de ",n, "es aproximadamente de ",f) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment