Skip to content

millcrest/python-dev-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Developer Test: Matrix Transposition

This test is designed to assess your ability to implement matrix transposition in Python.

Task

Implement a Python function transpose_matrix(matrix) that takes a 2D matrix as input and returns the transposed matrix. The transposed matrix should have its rows converted to columns and columns converted to rows.

Example

For example, given the following input matrix:

matrix = [
    [1, 2, 3],
    [4, 5, 6],
    [7, 8, 9]
]

The expected output would be:

transposed_matrix = [
    [1, 4, 7],
    [2, 5, 8],
    [3, 6, 9]
]

Requirements

  • Implement the transpose_matrix function.
  • The function should handle matrices of arbitrary sizes (not necessarily square matrices).
  • Do not use any built-in functions or external libraries that directly solve this task.

Unit Tests

A set of unit tests is provided in the file to verify the correctness of your implementation. Running the file runs the tests.

Instructions

  1. Clone this repository to your local machine.
  2. Implement the transpose_matrix function in the transpose_matrix.py file.
  3. Run the unit tests to validate your implementation.
  4. Once you are satisfied with your solution, submit your code for review.

Good luck!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages