Re: [Tutor] on the way to find pi

2005-01-23 Thread Orri Ganel
Ali Polatel wrote: dear friends , I found a code which calculates pi with an interesting algorithm the programme code is below: from sys import stdout def f((q,r,t,k)):     n = (3*q+r) / t     if (4*q+r) / t == n:     return (10*q,10*(r-n*t),t,k,n)     else:     return (q*k, q*

Re: [Tutor] on the way to find pi

2005-01-23 Thread Max Noel
This code gives the number in an unusual format like "3.1415'None'" it has a number part and a string part . I want to seperate these from easc other but I couldn't manage. I mean when I try to turn it into string format then try to use things like [:4] or like that they don't work.Any idea ho

[Tutor] on the way to find pi

2005-01-23 Thread Ali Polatel
dear friends , I found a code which calculates pi with an interesting algorithm the programme code is below: from sys import stdout def f((q,r,t,k)):    n = (3*q+r) / t    if (4*q+r) / t == n:    return (10*q,10*(r-n*t),t,k,n)    else:    return (q*k, q*(4*k+2)+r*(2*k+1),t*(2*k+1),k+1) # Ca