一个数的平方根在1~x-1内
def find_sqrt_int(num): if not num: return left, right = 0, num while left <= right: mid = left + (right-left) / 2 if mid ** 2 >= num: index = mid right = mid -1 else: left = mid + 1 return int(index) if __name__ == '__main__': print(find_sqrt_int([]))