Untitled

 avatar
unknown
plain_text
a year ago
614 B
2
Indexable
def draw_grid(n, row_size=4, col_size=4):
    """
    Draws a grid of size n x n, with each cell of size row_size x col_size.

    Args:
    n (int): The number of rows and columns in the grid.
    row_size (int): The number of rows in each cell. Defaults to 4.
    col_size (int): The number of columns in each cell. Defaults to 4.

    Returns:
    None
    """
    for i in range(n):
        if i % 2 == 0:
            print("+" + "-" * (col_size * n) + "+")
        for j in range(n):
            if j % 2 == 0:
                print("|", end="")
            print(" " * col_size + "|", end="")
        print()
Editor is loading...
Leave a Comment