From 4a554e5b1c988b3e8150d63e253817dd325bb125 Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 7 Apr 2025 16:14:27 -0700 Subject: [PATCH] Add q1.py --- q1.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 q1.py diff --git a/q1.py b/q1.py new file mode 100644 index 0000000..054d9b2 --- /dev/null +++ b/q1.py @@ -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)