In [90]: qty = np.array([100, 200, 150])
In [91]: div_by_2 = lambda x: (x % 2) == 0
In [92]: div_by_2(qty)
Out[92]: array([ True, True, True])
In [93]: div_by2_notby5 = lambda x: (((x % 2) == 0) and ((x % 5) != 0))
In [94]: div_by2_notby5(10)
Out[94]: False
In [95]: div_by2_notby5(6)
Out[95]: True
In [97]: div_by2_notby5(qty)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-97-ee3b041f6045> in <module>()
----> 1 div_by2_notby5(qty)
<ipython-input-93-9b7250c23a2a> in <lambda>(x)
----> 1 div_by2_notby5 = lambda x: (((x % 2) == 0) and ((x % 5) == 1))
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
Question> I try to find the number that is dividable by 2 but 5. The Python compiler complains about the ambiguous. How do I fix the issue?
Thank you