I'm having a little trouble translating C++ to python. The trouble I have is with the boolean statements in the for loop for (Nbound = 1; Nbound < (Nobs + 1) && B < Beta; Nbound++) and for (Ndm = 0;(Ndm < (i + 1) && P3 > (0)) || PP == 0; Ndm++). I'm unsure how this would work in python, I don't think python allows boolean statements in a for loop, so I think I would have to call it inside with an IF statement, but I'm not entirely sure. Thanks for your help!
also, I've noticed a lot of empty variables in this code for example, float PP is there a way of doing this in python or would I just assign it a value of 0 then change it later?
float Pf = 0; //The complement of Beta
float B = 0; //Beta
float P3;
float PP;
float Nbound = 1;
for (Nbound = 1; Nbound < (Nobs + 1) && B < Beta; Nbound++) {
int Ndm = 0;
int Nbgd = Nobs; //Setting Ndm=Nobs
Pf = 0; //Zeroing the placeholder for the sum
float exp; //A variable to store the exponential
for (int i = 0; i < (Nobs + 1); i++) //Summing over Nbgd+Ndm<NObs
{
P3 = 1;
PP = 0;
if (P1[Nbgd] > 0) {
for (Ndm = 0;(Ndm < (i + 1) && P3 > (0)) || PP == 0; Ndm++) {
//P3 = dist(Ndm, Nbound);
Pf = Pf + (P1[Nbgd] * P3); //Summing over the probability
PP = PP + P3;
}
}
}
}
}
for Nbound in range(1, Nobs + 1): if B >= Beta: breakB,Beta,P3norPPinfluence the loop conditions here, so it can befor Nbound in range(1, Nobs + 1): for i in range(0, Nobs + 1): for Ndm in range(0, i + 1):