Skip to content

Instantly share code, notes, and snippets.

@ejmurray
Created September 11, 2015 15:08
Show Gist options
  • Save ejmurray/599cc2a5f14a0076d2f1 to your computer and use it in GitHub Desktop.
Save ejmurray/599cc2a5f14a0076d2f1 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
"""
Prints a grid using functions.
Could add the spaces between the bars using " " * 4
"""
def line_tme():
bar = "+"+"-" * 4 + "+" + "-" * 4
print bar + bar + "+"
def line_mid():
row = "| | |\n"
row2 = "| | |"
print row * 3, row2
def grid():
line_tme()
line_mid()
line_tme()
line_mid()
line_tme()
# draw the same grid with four rows and and four columns.
def big_grid():
line_tme()
line_mid()
# grid()
big_grid()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment