# Create an array of zeroszeros=np.zeros((2,3))# Create an array of onesones=np.ones((2,3))# Create an array with a range of valuesrange_array=np.arange(0,10,2)# Create an array with linearly spaced valueslinspace_array=np.linspace(0,1,5)
importnumpyasnp# Create an arrayarr=np.array([[1,2,3],[4,5,6]])# Print the arrayprint('Array:', arr)# Array attributesprint('Shape:',arr.shape)print('Size:',arr.size)print('Data type:',arr.dtype)# Array operationsprint('Sum of all elements:',arr.sum())print('Mean of all elements:',arr.mean())print('Standard deviation:',arr.std())# Indexing and slicingprint('Element at (0, 1):',arr[0,1])print('First row:',arr[0,:])print('Second column:',arr[:,1])# Reshape the arrayreshaped=arr.reshape((3,2))print('Reshaped array:', reshaped)# Transpose the arraytransposed=arr.Tprint('Transposed array:', transposed)