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!

2
  • you can try this tmp = [[1,2,3],[4,5,6],[7,8,9]] print([line for line in tmp[::-1]]) Commented Feb 8, 2022 at 9: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 Commented Feb 8, 2022 at 9:32

1 Answer 1

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])
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.