0

I mean I have a 2d array. I can traverse it by row by row or column by column from the left side or the starting element. I want to do the same procedure starting from the top right and end at bottom right by row by row. Also, want to traverse from top right and end at top left column by column.

Thanks in advance for the help!

Christoph Rackwitz
  • 11,317
  • 4
  • 27
  • 36
  • you can try this `tmp = [[1,2,3],[4,5,6],[7,8,9]] print([line for line in tmp[::-1]])` – Abhishek Feb 08 '22 at 09:27
  • "*starting from the top right and end at bottom right*". Do you rather mean ending at the bottom **left**? The question is unclear, you should provide a concrete example – mozway Feb 08 '22 at 09:32

1 Answers1

0

Try using np.flipud

import numpy as np
A = [1, 2,3,4,5]
np.flipud(A)

Output:

array([5, 4, 3, 2, 1])