a = np.array([1, 2, 3, 4])
b = np.array([1, 2, 1, 2])
print a + b
print a - b
print a * b
print a / b
print a ** b
[2 4 4 6]
[0 0 2 2]
[1 4 3 8]
[1 1 3 2]
[ 1 4 3 16]
a = np.array([1, 2, 3, 4])
b = 2
print a + b
print a - b
print a * b
print a / b
print a ** b
[3 4 5 6]
[-1 0 1 2]
[2 4 6 8]
[0 1 1 2]
[ 1 4 9 16]
a = np.array([True, True, False, False])
b = np.array([True, False, True, False])
print a & b
print a | b
print ~a
print a & True
print a & False
print a | True
print a | False
[ True False False False]
[ True True True False]
[False False True True]
[ True True False False]
[False False False False]
[ True True True True]
[ True True False False]
a = np.array([1, 2, 3, 4, 5])
b = np.array([5, 4, 3, 2, 1])
print a > b
print a >= b
print a < b
print a <= b
print a == b
print a != b
[False False False True True]
[False False True True True]
[ True True False False False]
[ True True True False False]
[False False True False False]
[ True True False True True]
a = np.array([1, 2, 3, 4])
b = 2
print a > b
print a >= b
print a < b
print a <= b
print a == b
print a != b
[False False True True]
[False True True True]
[ True False False False]
[ True True False False]
[False True False False]
[ True False True True]