from typing import List def isRectangular(L: List[List[int]]) -> bool: """Check if the length of each row is equal to the length of the first row.""" return all(len(row) == len(L[0]) for row in L) def testIsRectangular(): print("Testing isRectangular()...", end="") L = [[1, 2, 3], [4, 5, 6]] assert isRectangular(L) == True L = [[1, 2], [4, 5, 6]] assert isRectangular(L) == False L = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]] assert isRectangular(L) == True print("Passed!") def main(): testIsRectangular() main()