import numpy as np
a = np.arange(4)
b = np.arange(4, 11, 2)
print(a)
print(b)
a_plus_b = a + b
print(a_plus_b)
a_multiplication_b = a * b
print(a_multiplication_b)
boolean_arr = b < 7
print(boolean_arr)
a += 1
print(a)
aa = np.array([[1, 2], [3, 4]])
bb = np.array([[1, 2], [3, 4]])
print(aa * bb)
print(aa.dot(bb))
random_arr = np.random.random((2, 3))
print(random_arr)
sum_random = random_arr.sum()
print('sum of array: ', sum_random)
print('minimum value of array: ', random_arr.min())
print('maximum value of array: ', random_arr.max())
print(random_arr.min(axis=0))
print(random_arr.min(axis=1))
print(a)
print(a[1:3])
print(a[-1])
for x in a:
print(x)
b = np.array([[1, 2, 3, 4, 5], [11, 12, 13, 14, 15], [21, 22, 23, 24, 25], [31, 32, 33, 34, 35], [41, 42, 43, 44, 45]])
print('traversal array and treat it as one dimensional array:')
for x in b:
print(x, end=",")
print()
print('traversal array for every element:')
for x in b:
for y in x:
print(y, end=" ")
print()
print('Slice the multidimensional array 1:')
print(b[:, 1])
print('Slice the multidimensional array 2:')
print(b[1:3, :])
c = np.array([[[1, 2, 3], [11, 12, 13]], [[4, 5, 6], [14, 15, 16]], [[7, 8, 9], [17, 18, 19]]])
print(c[1, ...])
print(c[..., 2])