1. 平方根的计算

def babylonian(s, x0, n_iter):
    x = x0
    for _ in range(n_iter):
        x = (x + s/x)/2
        print(x)
    return x

2. 完全平方数的判断

https://stackoverflow.com/questions/2489435/how-could-i-check-if-a-number-is-a-perfect-square

posted on 2018-07-16 23:27  未雨愁眸  阅读(505)  评论(0编辑  收藏  举报