mardi 14 janvier 2020

Enforcing a condition in a For Loop

I am trying to enforce an IF condition in a For loop but it seems not working here. I have a snippet code here:

for iterate in range(N):
    for rows in range(rows):
        vector1 = function1(x, rows)
        x = vector1
        vector2 = function2(z, rows)
        z = vector2
        if a <= angle_between(x, z) <= b:    
            break

Here, "function1", "function2" and "angle_between" are all already defined functions. The "function1" and "function2" are called simultaneously in every loop and I want a situation where the ForLoop would stop at the If statement. However, when I ran my code and checked the final output of "angle_between", it was not in the range of (a, b). Was I wrong in my implementation here? Would appreciate any guide, please.

Aucun commentaire:

Enregistrer un commentaire