Skip to content

[fixed] unused variable, standalone running, import doctest module #4673

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Aug 28, 2021
Prev Previous commit
Next Next commit
Update spiral_print.py
  • Loading branch information
cclauss authored Aug 28, 2021
commit cd8cf0d32ce03fdc0c0de9e96af9c8ed1dc99ef6
21 changes: 11 additions & 10 deletions matrix/spiral_print.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,23 @@

Matrix must satisfy below conditions
i) matrix should be only one or two dimensional
ii)column of all the row should be equal
ii) column of all rows should be equal
"""

from collections.abc import Iterable


def checkMatrix(a):
def check_matrix(matrix):
# must be
if a and isinstance(a, Iterable):
prevLen = 0
for i in a:
if prevLen == 0:
prevLen = len(i)
result = True
elif prevLen == len(i):
result = True
if matrix and isinstance(matrix, Iterable):
if isinstance(matrix[0], Iterable):
prev_len = 0
for row in matrix:
if prev_len == 0:
prev_len = len(row)
result = True
else:
result = prev_len == len(row):
else:
result = False
else:
Expand Down