+ 2
Digits of Pi
why my code is not passing test of code coach? https://code.sololearn.com/c70VDwoHW2Fd/?ref=app
3 Respuestas
+ 4
import numpy as np
n = int(input())
p = 2 * 10 ** (n + 4)
a = p
i = 1
while a > 0:
a = a * i // (i * 2 + 1)
i += 1
p += a
p //= 1000
print(str(p)[-2])
+ 3
The description of the task states that you need to figure out up to a 1000 decimal places.
Try to print math.pi and see how many decimals you get.
So math.pi is not the solution, you got to find another way.
+ 2
You can type everything by hand (every digit)
https://code.sololearn.com/cPkpO2gmACEz/?ref=app