mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-05 09:21:13 +08:00
Remove some print statements within algorithmic functions (#7499)
* Remove commented-out print statements in algorithmic functions * Encapsulate non-algorithmic code in __main__ * Remove unused print_matrix function * Remove print statement in __init__ * Remove print statement from doctest * Encapsulate non-algorithmic code in __main__ * Modify algorithm to return instead of print * Encapsulate non-algorithmic code in __main__ * Refactor data_safety_checker to return instead of print * updating DIRECTORY.md * updating DIRECTORY.md * Apply suggestions from code review * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Co-authored-by: Christian Clauss <cclauss@me.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@ -69,8 +69,10 @@ def max_subarray_sum(array, left, right):
|
||||
return max(left_half_sum, right_half_sum, cross_sum)
|
||||
|
||||
|
||||
array = [-2, -5, 6, -2, -3, 1, 5, -6]
|
||||
array_length = len(array)
|
||||
print(
|
||||
"Maximum sum of contiguous subarray:", max_subarray_sum(array, 0, array_length - 1)
|
||||
)
|
||||
if __name__ == "__main__":
|
||||
array = [-2, -5, 6, -2, -3, 1, 5, -6]
|
||||
array_length = len(array)
|
||||
print(
|
||||
"Maximum sum of contiguous subarray:",
|
||||
max_subarray_sum(array, 0, array_length - 1),
|
||||
)
|
||||
|
@ -68,8 +68,7 @@ def matrix_dimensions(matrix: list) -> tuple[int, int]:
|
||||
|
||||
|
||||
def print_matrix(matrix: list) -> None:
|
||||
for i in range(len(matrix)):
|
||||
print(matrix[i])
|
||||
print("\n".join(str(line) for line in matrix))
|
||||
|
||||
|
||||
def actual_strassen(matrix_a: list, matrix_b: list) -> list:
|
||||
|
Reference in New Issue
Block a user