只能针对“11×11” 或者“7×7”这样的,其它的不行。但是很成功了
def sqrt(n):
lastGuess = 0
#我让他们两个相等,来建立循环的条件
nextGuess = n
#这样就给了lastGuess和nextGuess进行循环的条件
while lastGuess != nextGuess:
lastGuess += 1
nextGuess = (lastGuess + (n / lastGuess)) / 2
print(round(nextGuess), lastGuess)
sqrt(49)