MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / is_square

Function is_square

matrix/matrix_multiplication_recursion.py:58–68  ·  view source on GitHub ↗

>>> is_square([]) True >>> is_square(matrix_1_to_4) True >>> is_square(matrix_5_to_9_high) False

(matrix: Matrix)

Source from the content-addressed store, hash-verified

56
57
58def is_square(matrix: Matrix) -> bool:
59 """
60 >>> is_square([])
61 True
62 >>> is_square(matrix_1_to_4)
63 True
64 >>> is_square(matrix_5_to_9_high)
65 False
66 """
67 len_matrix = len(matrix)
68 return all(len(row) == len_matrix for row in matrix)
69
70
71def matrix_multiply(matrix_a: Matrix, matrix_b: Matrix) -> Matrix:

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected