I want to check if any value in the array is greater than a certain threshold,.... do something
But it seems the if loop in the following code does not work. It does not print 'yes' in the if loop even the conditions were satisfied. Any idea why?
import random
import numpy as np
data = []
for i in range(0,10):
val = random.randint(0,110)
data.append(val)
data_np = np.array(data)
if all(i>=100 for i in data_np):
print('yes')
print(data_np)
I want to check if **any** value [...], but in your code you useall()instead ofany()in your check.