Python题解 | #求解立方根#
求解立方根
https://www.nowcoder.com/practice/caf35ae421194a1090c22fe223357dca
from math import fabs
def func(a):
left = -20
right = 20
b = 0.0
while fabs(right - left) > 0.01:
b = (right + left) / 2
if b * b * b > a:
right = b
else:
left = b
return b
while True:
try:
a = float(input())
print("%.1f" % func(a))
except:
break
