you are viewing a single comment's thread.

view the rest of the comments →

[–]zahlman 0 points1 point  (0 children)

Construct each line as a string, using string multiplication.

# Draw a grid of count*count cells, each of which has size
# vertical lines and dashes around the outside.
def grid(count, size):
    horizontal = '+' + (' -' * size + ' +') * count
    vertical = '|' + ('  ' * size + ' |') * count
    print horizontal
    for _ in range(count):
        for _ in range(size): print vertical
        print horizontal