Complete the code to create a copy of the NumPy array 'a'.
import numpy as np a = np.array([1, 2, 3]) b = a.[1]()
Using copy() creates a new array independent of the original.
Complete the code to create a view of the NumPy array 'a'.
import numpy as np a = np.array([4, 5, 6]) b = a.[1]()
Using view() creates a new array object that looks at the same data.
Fix the error in the code to create a copy of the array slice.
import numpy as np a = np.array([7, 8, 9, 10]) slice_a = a[1:3] slice_copy = slice_a.[1]()
To avoid referencing the original data, use copy() on the slice.
Fill both blanks to create a view and then modify it without affecting the original array.
import numpy as np a = np.array([10, 20, 30, 40]) view_a = a.[1]() copy_a = view_a.[2]() copy_a[0] = 99
First create a view with view(), then a copy with copy() to modify safely.
Fill all three blanks to create a copy of a reshaped array slice.
import numpy as np a = np.arange(12) slice_a = a[2:10] reshaped = slice_a.[1]((2, 4)) copy_reshaped = reshaped.[2]() copy_reshaped[0, 0] = [3]
First reshape the slice, then copy it, then modify the copy safely.
