increased range of array to (1, 21) and added comparison of array % 2 == 0

This commit is contained in:
Donald Calloway 2025-09-29 09:55:20 -07:00
parent d8adc75a00
commit 37939965d2

View File

@ -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.