Discussions Q&R
python (while) cycle
0 Vote
1 RĂ©ponseWhy
-1 Vote
2 RĂ©ponsesI'm trying to calculate the decimal places of pi with Ramanujan's formula. but with this code I'm getting the same output for all values of n, which it shouldn't.
from math import sqrt, factorial as f
sum=0
n=0
k=(2*sqrt(2)/9801)
while n<=100000:
sum=sum+((f(4*n))*(1103+(26390*n)))/(((f(n))**4)*(396**(4*n)))
y=1/(k*sum)
print('%.60f' % y)
n=n+1
where am I doing wrong?
2 Votes
4 RĂ©ponsesSimple code issue
1 Vote
1 RĂ©ponseJava
-1 Vote
4 RĂ©ponsesvariable is ambiguous
0 Vote
2 RĂ©ponsesHow to use "WHILE"
0 Vote
1 RĂ©ponseloops
0 Vote
1 RĂ©ponsepyton array Q!
0 Vote
1 RĂ©ponseSubtraction problem
0 Vote
3 RĂ©ponsesMoney Rate Income
1 Vote
1 RĂ©ponseAujourd'hui en vedette
Best Python Calculator Code
1 Votes
New code
1 Votes
Clean Code
3 Votes
Hello Everyone
0 Votes
How would you solve the part of the C# Intermediate code project that requires operator overloading?
0 Votes
Installation
0 Votes