I would like the code to return "fail" statement if the numpy array contains value that is not 0 or 10. Checking 2nd and 3rd column, as long as there is one value that doesn't satisfy the criteria, the code returns "fail". My code always return pass.
data file has the format:
0 0 0 0
1 0 0 0
2 0 0 0
3 0 0 0
4 50 10 0
5 10 10 0
6 10 10 0
7 10 10 0
data = np.loadtxt('datafile.txt')
x1, x2 = data[:,1], data[:2]
if (x1.any != 0 or x1.any !=10):
x1label = 'fail'
else:
x1label = 'pass'
if (x2.any !=0 or x2.any !=10):
x2label = 'fail'
else:
x2label = 'pass'
if (x1label == 'fail') or (x2label == 'fail'):
label = 'fail'
else:
label = 'pass'