Last active
July 26, 2016 17:02
-
-
Save zohaad/81268adeabc8c9c7a27adfe855034dcb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def verticals(arg): # making the verticals | |
print('| ' * arg, '|') | |
def do_four_times(f, arg): # 4 times repeater | |
f(arg) | |
f(arg) | |
f(arg) | |
f(arg) | |
def onestroke(dim, vert_func): # make one row | |
print('+ - - - - ' * dim, '+') # first, the line with the +'s | |
do_four_times(vert_func, dim) # then the 4 verticals | |
def dimstrokes(f, dim, one_func): # make "dim" rows | |
x = 1 | |
while x <= dim: | |
f(dim, one_func) | |
x += 1 | |
def draw_square(dim): | |
dimstrokes(onestroke, dim, verticals) # calling it | |
print('+ - - - - ' * dim, '+') # closing it off | |
draw_square(6) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for the input!
I changed the
a
todim
and theb
to eithervert_func
orone_func
to avoid confusion.