from functools import reduce import itertools def _pi(n): cys = itertools.cycle((4, -4)) return reduce(lambda x, y: x + next(cys) / y, range(1, n + 1, 2), 0) if __name__ == '__main__': print(_pi(10000))
Sign in to make a reply
月之轮回丶