+ 1
How to print pi(3.1415.......)? Python
Pi can print?
3 Respostas
+ 7
from math import pi
print(pi)
+ 2
print (22/7)
+ 2
# more practical (Python 3.8>)
pi_gen = lambda pre: [[D:=__import__('decimal').Decimal,setattr(__import__('decimal').getcontext(),'prec',600)],[p:=D(3).sqrt()*sum(D(2-k%2*4)/3**k/(2*k+1)for k in range(1100)),print(str(p)[:pre+2])]]and None
pi_gen(int(input()))