Zero-copy memory views with arr[start:stop:step], row slicing, and array reversing.
Slicing extracts sub-arrays using `start:stop:step` notation. In NumPy, basic slicing creates a zero-copy memory 'view' pointing directly to the original array.
A slice is a window or frame placed over an existing canvas. It doesn't paint a new picture; it just looks at a portion of the original artwork.
NumPy slices do NOT copy data into new memory. They create views with adjusted stride offsets.
sub = arr[1:4]sub = arr[1:4]; sub[0] = 999 # Accidental mutation of original array!sub = arr[1:4].copy(); sub[0] = 999Use `.copy()` if you want an independent duplicate that will not affect the original array.
Solve the objective below using NumPy vectorized syntax
Create `arr = np.array([1, 2, 3, 4, 5])`, reverse it using slice `[::-1]`, and print the result.
[5 4 3 2 1]