lundi 30 novembre 2020

crossing if statement function in python

I am trying to make an if statement that only goes through when the green line is crossed by the black line or if the red line crosses the black line. Note that the green and red line values are not equivalent to black_line values so i cannot use the <=, >= or == functions when defining the if statement.

black_line = [*black line values]
green_line = [*green line values]
red_line = [*red line values]
for i in range(len(black_line)):
    if green_line [i] crosses black_line[i]:   
        print("green line crossed")
    elif red_line [i] crosses black_line[i]:   
        print("red line crossed")

enter image description here

Aucun commentaire:

Enregistrer un commentaire