the-honk/python/calculators/sqrt.py
2024-10-09 18:02:32 +01:00

7 lines
107 B
Python

def sqrt(x):
a = 2
while abs((a - (x / a))) > 1:
a = (a + (x / a)) / 2
return int(a)
print(sqrt(81))