Print pi to a number of decimal places

前端 未结 7 2486
感情败类
感情败类 2020-12-19 08:56

One of the challenges on w3resources is to print pi to \'n\' decimal places. Here is my code:

from math import pi

fraser = str(pi)

length_of_pi = []

numbe         


        
7条回答
  •  不知归路
    2020-12-19 09:47

    For example the mpmath package

    from mpmath import mp
    def a(n):
       mp.dps=n+1
       return(mp.pi)
    

提交回复
热议问题