I have two lists in Python:
a = [1, 5, 5]
b = [2, 10, 8]
If 1 < 2
and 5 < 10
and 5 < 8
, that is, if each element of the list a
is less than its corresponding element list b
, then the variable c
will be% 1
; if it will not be worth 0
.
I tried to do it using numpy.where
but then I can not find a function that says if the resulting vector is empty or not (an equivalent to isempty
of matlab)
This is what I have tried for the moment:
a = [10, 10, 10]
b = [1, 1, 1]
a = np.asarray(a)
b = np.asarray(b)
if np.where(abs(a) / 5 < abs(b)): residual_check = 1
else: residual_check = 0
print(residual_check)
How could I do it?