Simplify the declarations of the Python code.

This commit is contained in:
krahets
2023-05-22 22:03:57 +08:00
parent 081b76d620
commit e196962d0a
27 changed files with 88 additions and 87 deletions

View File

@ -10,10 +10,9 @@ from .linked_list import ListNode, linked_list_to_list
def print_matrix(mat: list[list[int]]) -> None:
"""Print a matrix"""
s: list[str] = []
s = []
for arr in mat:
s.append(" " + str(arr))
print("[\n" + ",\n".join(s) + "\n]")
@ -47,7 +46,7 @@ def print_tree(
if root is None:
return
prev_str: str = " "
prev_str = " "
trunk = Trunk(prev, prev_str)
print_tree(root.right, trunk, True)