Skip to content

Commit 0df3e2e

Browse files
committed
Conflicts: Solutions/Session01/print_grid.py
2 parents 5252d38 + 8c93ca5 commit 0df3e2e

20 files changed

+377
-114
lines changed

Solutions/Session01/print_grid.py

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,46 +6,47 @@
66
Note that we only did the basics of loops, and you can
77
do all this without any loops at all, so that's what I did.
88
9-
Note also that there is nore than one way to skin a cat -- or code a function
9+
Note also that there is more than one way to skin a cat --
10+
or code a function
1011
"""
1112

1213

1314
def print_grid(size):
1415
"""
1516
print a 2x2 grid with a total size of size
1617
17-
:param size: total size of grid -- it will be rounded if not one
18-
more than a multiple of 2
18+
:param size: total size of grid -- it will be rounded if not one more than
19+
a multiple of 2
1920
"""
20-
N = 2
21-
s = int( (size-1) // 2 ) # size of one grid box
22-
print "s:", s
21+
number = 2
22+
box_size = int((size-1) // 2) # size of one grid box
23+
print "box_size:", box_size
2324
# top row
24-
top = ('+ ' + '- '*s)*N + '+' + '\n'
25-
middle = ('| ' + ' '*2*s)*N + '|' + '\n'
25+
top = ('+ ' + '- ' * box_size) * number + '+' + '\n'
26+
middle = ('| ' + ' ' * 2 * box_size) * number + '|' + '\n'
2627

27-
row = top + middle*s
28+
row = top + middle*box_size
2829

29-
grid = row*N + top
30+
grid = row*number + top
3031

3132
print grid
3233

3334

34-
def print_grid2(N, s):
35+
def print_grid2(number, size):
3536
"""
36-
print a NxN grid with each box of size s
37+
print a number x number grid with each box of size width and height
3738
38-
:param N: number of grid boxes (row and column)
39+
:param number: number of grid boxes (row and column)
3940
40-
:param s: size of each grid box
41+
:param size: size of each grid box
4142
"""
4243
# top row
43-
top = ('+ ' + '- '*s)*N + '+' + '\n'
44-
middle = ('| ' + ' '*2*s)*N + '|' + '\n'
44+
top = ('+ ' + '- '*size)*number + '+' + '\n'
45+
middle = ('| ' + ' '*2*size)*number + '|' + '\n'
4546

46-
row = top + middle*s
47+
row = top + middle*size
4748

48-
grid = row*N + top
49+
grid = row*number + top
4950

5051
print grid
5152

@@ -54,14 +55,15 @@ def print_grid3(size):
5455
"""
5556
same as print_grid, but calling print_grid2 to do the work
5657
"""
57-
N = 2
58-
s = (size-1) / 2 # size of one grid box
59-
print_grid2(N, s)
58+
number = 2
59+
box_size = (size-1) / 2 # size of one grid box
60+
print_grid2(number, box_size)
61+
6062

6163
print_grid(11)
6264
print_grid(7)
6365

64-
print_grid2(3,3)
65-
print_grid2(3,5)
66+
print_grid2(3, 3)
67+
print_grid2(3, 5)
6668

6769
print_grid3(11)

slides_sources/ToDo.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ so I'm stripping the 'u' from string literals wherever I find them.
1111

1212
[x] Add outline of class to beginning of slides
1313

14-
[ ] Add section breaks to slides for LAB time and lightning talks:
14+
[x] Add section breaks to slides for LAB time and lightning talks:
1515
some lecture
1616
some lab time
1717
two lightning talks
@@ -21,6 +21,8 @@ so I'm stripping the 'u' from string literals wherever I find them.
2121
I think we shouod remove the parameter unpacking: *args and **kwargs --
2222
too much when you don't really know what a tuple or dict is...
2323

24+
[x] Remove parameter unpacking
25+
2426
[ ] Add more to the function lab -- should be 20min or so of work.
2527
- they have learned about returning multiple values.
2628

slides_sources/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ gnureadline==6.2.5
88
# hieroglyph==0.7.dev
99
-e git+https://github.com/nyergler/hieroglyph.git#egg=hieroglyph
1010
ipython==2.3.0
11+
libsass==0.5.1

slides_sources/scss_sources/slides_custom.scss

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,17 @@ article {
112112
font-size: inherit;
113113
}
114114
}
115+
.figure {
116+
text-align: center;
117+
a.center {
118+
margin: auto;
119+
text-decoration: none;
120+
border: none;
121+
img.center {
122+
margin: auto;
123+
}
124+
}
125+
}
115126
dl {
116127
margin-bottom: 10em;
117128
dt {
144 KB
Loading
94.1 KB
Loading
144 KB
Loading
130 KB
Loading
57.2 KB
Loading
63.8 KB
Loading

0 commit comments

Comments
 (0)