Skip to content

Commit 11c9016

Browse files
committed
Use classes for solutions, first on OpenTechSchool#48
1 parent 732240b commit 11c9016

8 files changed

Lines changed: 30 additions & 1 deletion

File tree

‎source/_static/spoilers.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,6 @@
3838
(function ($) {
3939
$(document).ready(function() {
4040
'use strict';
41-
$("h3:contains('Solution')").next().showHide();
41+
$(".solution h3").next().showHide();
4242
});
4343
})(jQuery);

‎source/conditional_loops.rst‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ functions, perhaps a ``while`` loop and a bit of conditional logic.
6262
It's a bit of a stretch but keep at it! Don't be afraid to talk it out
6363
with a coach or another student.
6464

65+
.. rst-class:: solution
66+
6567
Solution
6668
--------
6769

@@ -100,6 +102,8 @@ respectively.
100102
To draw a spiral, the turtle has to rotate by a constant value and move
101103
forward by an increasing value.
102104

105+
.. rst-class:: solution
106+
103107
Solution
104108
--------
105109

‎source/functions.rst‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ Write a function that draws a square. Could you use this function to improve the
8282
tilted squares program? If you change the program to use a function, is it easier
8383
to experiment with?
8484

85+
.. rst-class:: solution
86+
8587
Solution
8688
--------
8789

@@ -133,6 +135,9 @@ Give it a good go!
133135
position and angle it was before it was asked to draw the hexagon. This
134136
makes it easier to reason about.
135137

138+
139+
.. rst-class:: solution
140+
136141
Solution
137142
--------
138143

‎source/functions_parameters.rst‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ Exercise
5555
Write a function that allows you to draw hexagons of any size you want, each
5656
time you call the function.
5757

58+
.. rst-class:: solution
59+
5860
Solution
5961
--------
6062

@@ -82,6 +84,8 @@ Here's an example of drawing shapes with this function:
8284

8385
The sum of the external angles of any shape is always 360 degrees!
8486

87+
.. rst-class:: solution
88+
8589
Solution
8690
--------
8791

‎source/logical_operators.rst‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ toggle between drawing while moving, or just moving without a trace.
3232

3333
Can we write a function that only goes forward if the pen is up?
3434

35+
.. rst-class:: solution
36+
3537
Solution
3638
--------
3739

@@ -67,6 +69,8 @@ Earlier we put the turtle in a circular prison. This time let's make
6769
it a box. If the turtle goes more than 100 in the X *or* Y axis then
6870
we turn the turtle back around to the center.
6971

72+
.. rst-class:: solution
73+
7074
Solution
7175
--------
7276

‎source/loops.rst‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ use ``turtle.pendown()``.
7878

7979
.. image:: /images/dashed.png
8080

81+
.. rst-class:: solution
82+
8183
Solution
8284
--------
8385

@@ -130,6 +132,8 @@ The squares we were drawing at the start of this tutorial had a lot of
130132
repeated lines of code. Can you write out a square drawing program in fewer
131133
lines by utilizing loops?
132134

135+
.. rst-class:: solution
136+
133137
Solution
134138
--------
135139

‎source/simple_drawing.rst‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ Draw a square as in the following picture:
110110

111111
For a square you will probably need a right angle, which is 90 degrees.
112112

113+
.. rst-class:: solution
114+
113115
Solution
114116
--------
115117

@@ -183,6 +185,8 @@ Can you draw a rectangle too?
183185

184186
.. image:: /images/rectangle.png
185187

188+
.. rst-class:: solution
189+
186190
Solution
187191
--------
188192

@@ -217,6 +221,8 @@ experiment with the angles between the individual squares.
217221

218222
The picture shows three 20 degree turns. You could try 20, 30 and 40, for example.
219223

224+
.. rst-class:: solution
225+
220226
Solution
221227
--------
222228

‎source/variables.rst‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ Exercise
4848
If we have a variable called ``angle``, how could we use that to experiment
4949
much faster with our tilted squares program?
5050

51+
.. rst-class:: solution
52+
5153
Solution
5254
--------
5355

0 commit comments

Comments
 (0)