Calculating Leibniz of Pi I have this Python program for calculating Leibniz of 'pi'. I am not able to shorten it more. Can anyone here optimise/shorten it?

s,a,b=0,[],[]
for i in range(int(input())):a.append(input())
for x in a:
    for j in range(int(x)):s+=pow(-1,int(j))/((2*int(j))+1)
    b.append(s)
    s=0
for i in b:print("{0:.15f}".format(i))
This is only micro optimization, I don't think it will make a difference, but here you go anyway:

b=[]
for i in range(int(input())):
    s=sum([pow(-1,j)/(2*j+1) for j in range(int(input()))])
    b.append("{0:.15f}".format(s))
for x in b:print(b)



Instead of 3 loops, there is only one
Removed unnecessary intermediary variables
Removed int(j), j is already int
Removed extra brackets, for example (2*int(j))+1 is the same as 2*j+1
Removed an unnecessary s=0


You could of course write the whole thing on a single line, but now that's starting to hurt readability...

for x in ["{0:.15f}".format(sum([pow(-1,j)/(2*j+1) for j in range(int(input()))])) for i in range(int(input()))]:print(x)