the-honk/school/royal institute/from ancient babylon to quantum computing/babylonian square root.py
2021-12-21 19:46:28 +00:00

7 lines
148 B
Python

x = float(input('Please input the number to calculate the square root of! '))
a = 2
while abs((a - (x / a))) > 1:
a = (a + (x / a)) / 2
print(a)