the-honk/royal institute computer science masterclass 2021/from ancient babylon to quantum computing/babylonian square root.py
2024-10-09 18:02:34 +01: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)