Untitled

mail@pastecode.io avatar
unknown
plain_text
8 months ago
594 B
2
Indexable
Never
def draw_grid(rows, columns):
    for i in range(rows):
        print("+", end=" ")
        print("- " * (columns-1), end="")
        print("+", end=" ")
        print("- " * (columns-1), end="")
        print("+")
        for j in range(4):
            print("|", end=" ")
            print("  " * (columns-1), end="")
            print("|", end=" ")
            print("  " * (columns-1), end="")
            print("|")
    print("+", end=" ")
    print("- " * (columns-1), end="")
    print("+", end=" ")
    print("- " * (columns-1), end="")
    print("+")

# Example usage:
draw_grid(2, 4)
Leave a Comment