Add q1.py

This commit is contained in:
2025-04-07 16:14:27 -07:00
parent 407c496469
commit 4a554e5b1c

16
q1.py Normal file
View File

@@ -0,0 +1,16 @@
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)