Python problem

2013-02-19 Thread ach360
I'm so lost. Given the formula pi=4-4/3+4/5-4/7+4/9-4/11+.. How do I print 
a table showing approximate value of pi by computing one term4-4/3 then two 
terms4-4/3+4/5, and so on.Then how many terms of the series before I get 3.14, 
3.141, 3.1415, 3.14159. Please helps computer teacher literally says figure it 
out and doesn't help and expects a perfect program.this is in python 3 please 
give an answer I can understand and an example. 
Thanks :) :) 
I need this right now. 
Thanks for your time.

I need this ASAP
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python problem

2013-02-19 Thread ach360
Loop_variable= 1
Pi=1.0
term=0
T=1.0
While (loop_variable> 0):
 Loop_variable=Loop_variable+1
 T=T+2.0
 
If (loop_variable%2 ==0):
 Term=0;
Else:
  term=1;


If term  ==0:
 Pi=Pi- float(1/T);
Else:
   Pi=Pi+ float(1/T);


 

-- 
http://mail.python.org/mailman/listinfo/python-list