Print pi to a number of decimal places

前端 未结 7 2369
感情败类
感情败类 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)
    
    0 讨论(0)
提交回复
热议问题