diff --git a/array_comparisons.py b/array_comparisons.py index d9cc0e4..f4d2420 100644 --- a/array_comparisons.py +++ b/array_comparisons.py @@ -1,6 +1,6 @@ import numpy as np # Creating an array of integers from 1 to 10 inclusive -array = np.arange(1, 11) +array = np.arange(1, 21) # Retrieving elements greater than or equal to 5 AND less than 9 print(array[(array >= 5) & (array < 9)]) # Retrieving elements less than or equal to 4 AND not equal to 2 @@ -9,6 +9,7 @@ print(array[(array != 2) & (array <= 4)]) print(array[(array < 3) | (array == 8)]) # Retrieving elements between 2 inclusive AND 5 inclusive OR equal to 9 print(array[(array >= 2) & (array <= 5) | (array == 9)]) +print(array[(array % 2 == 0)]) ''' If both conditions are true, | returns True, otherwise returns False.