🚀 Hurry! Offer Ends In
00 Days
00 Hours
00 Mins
00 Secs
Enroll Now
X
Questions




































Write a python program to find the transpose of a given matrix.

Last Updated : 11 Sep 2026 Jul 23

Solution:

import numpy as np

# Create a numpy array
matrix = np.array([
    [1, 2, 3],
    [4, 5, 6]
])

# Use the .T attribute to transpose
transpose = matrix.T

print("Transposed Matrix (NumPy):")
print(transpose)

output:

Original Matrix:
[1, 2, 3]
[4, 5, 6]

Transposed Matrix:
[1, 4]
[2, 5]
[3, 6]

Report an error
Latest Updates