def f(x): return x - 1 x = -2 y = f(x) k = 0 while (y < 0): x += 0.01 y = f(x) k += 1 print(f'x = {x:.2e}') print(f'y = {y:.2e}') print('k =', k)