Returns an element that is greater than 10, given a list.
There are two ways to do this in Python. One method is loop traversal, the second method is to use the built-in function filter ()
In the array, there is an easier way. That is, the Boolean index
Boolean index:
A Boolean array of the same size is passed into the index, which returns an array of all the elements that correspond to the true position of the moth.
Make a cushion first.
So, here comes the point.
ARR>10 will determine each element in the array arr, returning a Boolean array.
Two-and or non-
1 Given a list, returns an element that is greater than 10 and is even.
Description
1) & is actually a bitwise-and concept
0101 =5
0110 =6
Add
0100 = 4 you got it!
2) & brackets on both sides because the,& operator has a higher precedence.
2 Given a list, returns an element that is greater than 10, or even. |
3 Given a list, returns an array of no greater than 10. ~
Numpy Array of type Boolean