Search code examples
python-2.7loopsmathscientific-computing

Loop for counting in python


I have two variables of data (BxHPF and ByHPF), which are equall in number of data. I would like to make a loop, which takes first value of BxHPF and ByHPF compute them, then take next one from BxHPF and ByHPF and so on. For now I have:

So I though about this way:

Computing = (float(BxHPF[0])/float(ByHPF[0]))
Dat1 = math.degrees(Computing)*(-1)

In fact those equations give me correct result. But as I wrote I need to make a loop, which will count every pair from BxHPF and ByHPF with using those two variables Computing and Dat1.

To be exact BxHPF and ByHPF contain 266150 records each.


Solution

  • All credits to @user202729 who solved my problem. Thank you.

    result = [math.degrees(x/y)*(-1) for x,y in zip(BxHPF,ByHPF)]