[+] Encapsulate ascii dimensions

This commit is contained in:
Azalea Gui
2023-03-08 01:59:03 -05:00
parent 7039cee223
commit 369c618d49
+7
View File
@@ -21,3 +21,10 @@ def setup_logger(debug: bool):
)
return logging.getLogger("a2")
def get_ascii_dimensions(ascii_art: str) -> tuple[int, int]:
"""Get the dimensions of an ASCII art."""
height = ascii_art.count('\n')
width = max(len(line.strip('\n')) for line in ascii_art.splitlines())
return height, width