Add formatted text to first three np arrays

This commit is contained in:
Donald Calloway 2025-09-29 10:18:23 -07:00
parent 37939965d2
commit d45a31970f

View File

@ -1,13 +1,13 @@
import numpy as np
# Сreating a 1D array of zeros with 5 elements
zeros_1d = np.zeros(5)
print(zeros_1d)
print(f'1D array of 5 zeros: {zeros_1d}')
# Сreating a 1D array of zeros with specifying dtype
zeros_1d_int = np.zeros(5, dtype=np.int8)
print(zeros_1d_int)
print(f'1D array of 5 zeros of dtype int8: {zeros_1d_int}')
# Сreating a 2D array of zeros of shape 5x3
zeros_2d = np.zeros((5, 3))
print(zeros_2d)
print(f'2D array of zeros of shape 5x3: {zeros_2d}')
# Create an array of zeros of size 5
zeros_array_1d = np.zeros(5)
@ -22,4 +22,5 @@ sevens_array_2d = np.full((2, 2), 7)
print(f'1D zeros array: {zeros_array_1d}, 1D ones array: {ones_array_1d}')
print(f'2D zeros array:\n{zeros_array_2d}')
print(f'2D ones array:\n{ones_array_2d}')
print(f'2D sevens array:\n{sevens_array_2d}')
print(f'2D sevens array:\n{sevens_array_2d}')