i , s, flag = 1, 0, 1 while abs(1 / i) > 1e-6: s += flag * 1 / i i += 2 flag = -1 * flag print(round(s *4, 5))