import numpy as np # Author: James Tam # Version: October 18, 2024 """ #Example 1: Double the value of each element in a composite containing composites """ print("Example 1: double value of numeric elements") anArray = np.array([[2,2,2], [3,3,3]]) anArray = anArray * 2 print(anArray) print() """ #Example 2: Display only 2nd,3d rows and the 1st and 2nd columns of those rows """ print("Example 2: slice off row index 1,2 and column index 0,1 of these rows into the copy") anArray = np.array([["a","b","c","d"], ["e","f","g","h"], ["i","j","k","l"], ["m","n","p","p"]]) #Display only 2nd,3rd rows and the 1st and 2nd columns of those rows print(anArray[1:3,0:2])