sum1 = 0 j = 1 i = 1 s = 0 while 1/i >= 10**-2: if s == 2: j = -j s = 0 else: a = 1/i*j sum1 += 1/i * j i += 2 s += 1 print("{:.6f}".format(sum1))