-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExercise 3.3. py
53 lines (40 loc) · 1.15 KB
/
Exercise 3.3. py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jan 21 08:59:29 2020
@author: msuherma
"""
# PART 1
# Making 2x2 grid
plus_col = '+'+' '+ (('-' + ' ')*4) # to make + started row
vert_col = '|' + 9*' ' # to make | started row
def fcn_2x(f):
f()
f()
def print_2x1plus_row(): # to call 2x1 row with + starting
print(2*(plus_col)+ '+')
def print_2x1horz_row(): # to call 2x1 row with | starting
print (2*vert_col+'|')
def print_2x1_grid(): # to call 2x2 grid
print_2x1plus_row()
fcn_2x(print_2x1horz_row)
def print_2x2_grid(): # to call 2x2 grid
fcn_2x(print_2x1_grid)
print_2x1plus_row()
# PART 2
# Making 4x4 grid
def fcn_4x(f):
f()
f()
f()
f()
def print_4x1plus_row(): # to call 4x1 row with + starting
print(4*(plus_col)+ '+')
def print_4x1horz_row(): # to call 4x1 row with | starting
print (4*vert_col+'|')
def print_4x1_grid(): # to call 4x1 grid
print_4x1plus_row()
fcn_4x(print_4x1horz_row)
def print_4x4_grid(): # to call 4x4 grid
fcn_4x(print_4x1_grid)
print_4x1plus_row()