I think you are saying “if Y not equal to 0, then…”, which programmatically is:
if Y != 0
Updating your loop. I’m guessing you want to avoid the insert into F
as well when Y is 0.
for n in range(1001):
h=N*nsv*G[n]*AF[n]
Y=h.real
if Y!=0:
print(Y)
p=math.log10(Y)
F.insert(n,p)