pi = 4( 1 - (1/3) + (1/5) - (1/7) + (1/9) - (1/11)+ ........... (-1)^(i+1) / (2i -1))

I have to write a program that displays the pi value for i = 10000, 20000,.....and 100000

def main(): i = 1 sum = 0 for i in range(10000, 100000 +1): pi = 4 * ( 1 - ((-1) ** ( i + 1) / (2 * i - 1))) if i == 10000 or i == 20000 or i == 30000 or i == 40000 or \ i == 50000 or i == 60000 or i == 70000 or i == 80000 or \ i == 90000 or i == 100000: sum = pi print("pi is", sum) main()

my code is only able to calculate the last term from the formula instead of the summation of series

can anyone help?

As a beginner of python, I am not good in loop stuff.