#二分法求平方根
class Solution:def sqrt(self , x ):result=x/2.0low=0.0high=x*1.0while abs(result**2-x)>0.00001:if result**2>x:high=resultresult=low+(result-low)/2.0else:low=resultresult=high-(high-result)/2.0print(result)
if __name__=='__main__':x=2Solution().sqrt(x)