import math
from random import randint
def my_sqrt(a):
x = randint(1, 100)
while True:
y = (x + a / x) / 2.0
if y == x:
break
x = y
return y
def main():
a = float(input("Enter number: "))
print(my_sqrt(a))
print(math.sqrt(a))
main()
Comments
Leave a comment