Create a script to transpose a matrix.

A matrix is represented as a list of lists, where each inner list represents a row of the matrix. To transpose a matrix, we need to convert its rows into columns and its columns into rows. 

Write a function called transpose_matrix(matrix) that takes a matrix as input and returns its transpose.

The transpose of a matrix is obtained by swapping its rows with columns. To do this, we can initialize an empty result matrix with the number of columns equal to the number of rows in the input matrix. Then, for each column index i in the input matrix, we iterate over each row index j and assign the value of the element at row j, column i in the input matrix to the element at row i, column j in the result matrix.

Example:

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

Output:
transpose_matrix(matrix) -> [[1, 4, 7], [2, 5, 8], [3, 6, 9]]

Constraints:
- The input matrix will always be a square matrix (number of rows = number of columns).
- The elements in the matrix can be integers or floats.
- The size of the matrix can range from 1x1 to 10x10.
- The elements in the matrix will always be within the range of [-100, 100].
Here is the script to transpose a matrix:

```python
def transpose_matrix(matrix):
    # Get the number of rows and columns in the matrix
    rows = len(matrix)
    columns = len(matrix[0])
    
    # Initialize an empty result matrix
    result = [[0] * rows for _ in range(columns)]
    
    # Transpose the matrix
    for i in range(columns):
        for j in range(rows):
            result[i][j] = matrix[j][i]
    
    return result
```

# Test the function with the provided example
matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
print(transpose_matrix(matrix))  # Output: [[1, 4, 7], [2, 5, 8], [3, 6, 9]]
```

This script defines a function called `transpose_matrix()` which takes a matrix as input and returns its transpose. It initializes an empty result matrix with the number of columns equal to the number of rows in the input matrix. Then, it iterates over each column index i and row index j in the input matrix, assigning the value of the element at row j, column i in the input matrix to the element at row i, column j in the result matrix. Finally, it returns the transposed matrix.