Tile a Row

easynumpy_combine

Implement tile_rows(x, r).

Given a 1D array x of length n and an integer r, return a 2D array of shape (r, n) in which every one of the r rows is a copy of x. No for/while loops.

Constraints
  • no for/while loops

Your solution

Edit tile_rows and run the real pytest suite in your browser — no install required. Your code is saved locally.

⌘/Ctrl + ↵

Loading the Python runtime (first run only)…

Hints

Hint 1

np.tile(x, (r, 1)) repeats the whole array x to make r identical rows.