Write a NumPy program to swap rows and columns of a given array in reverse order
import numpy as np nums = np.array([[[1, 2, 3, 4], [0, 1, 3, 4], [90, 91, 93, 94], [5, 0, 3, 2]]]) print("Original array:") print(nums) print("\nSwap rows and columns of the said array in reverse order:") new_nums = print(nums[::-1, ::-1]) print(new_nums)
Sample Output:
Original array: [[[ 1 2 3 4] [ 0 1 3 4] [90 91 93 94] [ 5 0 3 2]]] Swap rows and columns of the said array in reverse order: [[[ 5 0 3 2] [90 91 93 94] [ 0 1 3 4] [ 1 2 3 4]]] None
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Sample Output:
need an explanation for this answer? contact us directly to get an explanation for this answer