paddockpass/edx-python/w2/2.py
Christopher Talib 041e82774f Adding edx work
2019-07-03 12:20:01 +02:00

15 lines
242 B
Python

x = 23
epsilon = 0.01
step = 0.1
guess = 0.0
while abs(guess**2-x) >= epsilon:
if guess <= x:
guess += step
else:
break
if abs(guess**2 - x) >= epsilon:
print('failed')
else:
print('succeeded: ' + str(guess))