17 lines
463 B
Python
17 lines
463 B
Python
import numpy as np
|
|
# 1. Creat my_array and print the shape of it
|
|
my_arr = np.array([9, 8, 7, 6, 5, 4, 3, 2, 1])
|
|
print("Shape of my_arr: " + str(my_arr.shape))
|
|
|
|
#2 My_mat and its shape
|
|
my_mat = np.tile(my_arr, (3, 1))
|
|
print("Shape of my_mat " + str(my_mat.shape))
|
|
|
|
#3. Create my_prod and print it
|
|
my_prod = my_arr * my_arr
|
|
print("my_prod:" + str(my_prod))
|
|
|
|
#4. Sort my_prod and print it
|
|
my_prod_sorted = np.sort(my_prod)
|
|
print("My_prod sorted: ", my_prod_sorted)
|