Master np.tile(), np.repeat(), np.roll(), np.flip(), np.rot90(), and np.r_ / np.c_.
Advanced manipulation functions provide geometric transformations: `np.tile` repeats patterns as tiles, `np.repeat` duplicates individual elements, and `np.rot90` rotates matrices by 90 degrees.
`tile` is laying down duplicate square floor tiles. `repeat` is stuttering every single number twice (`[1, 1, 2, 2]`). `rot90` is turning a photo 90 degrees counter-clockwise.
`np.repeat([1, 2], 2)` produces `[1, 1, 2, 2]`. `np.tile([1, 2], 2)` produces `[1, 2, 1, 2]`.
t = np.tile(arr, 3); r = np.repeat(arr, 3)np.tile(arr, 2) # when expecting [1, 1, 2, 2]np.repeat(arr, 2)Remember: `repeat` duplicates each item consecutively; `tile` repeats the full pattern block.
Solve the objective below using NumPy vectorized syntax
Create `arr = np.array([10, 20])`, repeat each element 3 times with `np.repeat(arr, 3)`, and print.
[10 10 10 20 20 20]