Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolves #85 #86

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions code/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,25 @@ def print_grid():

print_grid()

# here is even less-straightforward solution that can print grids of any size
def draw_row(repeat, cols, marker, filler):
for i in range(cols):
print(marker, filler * repeat, ' ', sep='', end='')
print(marker)

def draw_grid(rows, cols, repeat=4):
draw_row(repeat, cols, '+', ' -')
for i in range(rows):
for i in range(repeat):
draw_row(repeat, cols, '|', ' ')
draw_row(repeat, cols, '+', ' -')

def main():
draw_grid(3, 3)

if '__main__' == __name__:
main()

comment = """
After writing a draft of the 4x4 grid, I noticed that many of the
functions had the same structure: they would do something, do
Expand Down