Python计算π值-麦克劳林公式
环境准备
Python版本: Python 3.6.4
IDE: Pycharm 2019.2.3
麦克劳林公式:

实现代码
# coding=utf-8my_pi = 2i = 1000while i > 0:my_pi = my_pi * i / (2 * i + 1) + 2i -= 1print(my_pi)
注:i值越大,求出的π值越精确
THE END
麦克劳林公式:

# coding=utf-8my_pi = 2i = 1000while i > 0:my_pi = my_pi * i / (2 * i + 1) + 2i -= 1print(my_pi)
注:i值越大,求出的π值越精确