Skip to content

Commit 9bb391b

Browse files
committed
Merged master into current and resolved conflict
1 parent 2a46c3b commit 9bb391b

10 files changed

Lines changed: 46 additions & 26 deletions

File tree

pretext/GeneralIntro/FormalandNaturalLanguages.ptx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@
5555
<p>Formal languages mean exactly what they say. On the other hand,
5656
natural languages are full of idiom and metaphor. If someone says, <q>The
5757
other shoe fell</q>, there is probably no shoe and nothing falling.</p>
58-
<tip>
58+
<note>
5959
<p>You'll need to find the original joke to understand the idiomatic
6060
meaning of the other shoe falling. <em>Yahoo! Answers</em> thinks it
6161
knows!</p>
62-
</tip>
62+
</note>
6363
</gi>
6464
</glossary>
6565
<p>People who grow up speaking a natural language&#x2014;everyone&#x2014;often have a hard

pretext/Inheritance/04-ReuseThroughComposition.ptx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ print(p.distanceFromOrigin())
3838
</input>
3939
</program>
4040
<p>The first thing to notice about this version of LabeledPoint
41-
does not inherit from Point. Instead, its constructor
41+
is that it does not inherit from Point. Instead, its constructor
4242
instantiates a Point and stores a reference to it in its <c>point</c>
4343
instance variable so that it can be used by the other methods.</p>
4444
<p>Next, notice how the <c>distanceFromOrigin()</c> method reuses the code in

pretext/IntroRecursion/TheThreeLawsofRecursion.ptx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
algorithm our primary data structure is a list, so we must focus our
3030
state-changing efforts on the list. Since the base case is a list of
3131
length 1, a natural progression toward the base case is to shorten the
32-
list. This is exactly what happens on line 5 of <xref ref="intro-recursion_calculatingthe-sumofa-listof-numbers"/> when we call <c>listsum</c> with a shorter list.</p>
32+
list. This is exactly what happens on line 5 of the ActiveCode in <xref ref="intro-recursion_calculating-the-sum-of-a-list-of-numbers"/> when we call <c>listsum</c> with a shorter list.</p>
3333
<p>The final law is that the algorithm must call itself. This is the very
3434
definition of recursion. Recursion is a confusing concept to many
3535
beginning programmers. As a novice programmer, you have learned that

pretext/IntroRecursion/intro-VisualizingRecursion.ptx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
going off to the left. If you think of this definition recursively it
3030
means that we will apply the recursive definition of a tree to both of
3131
the smaller left and right trees.</p>
32-
<p>Let's translate this idea to some Python code. <xref ref="lst-fractree"/>
33-
shows how we can use our turtle to generate a fractal tree. Let's look at
32+
<p>Let's translate this idea to some Python code. The <xref ref="intro-recursion_lst-fractree"/>
33+
below shows how we can use our turtle to generate a fractal tree. Let's look at
3434
the code a bit more closely. You will see that on lines 5 and 7 we are
3535
making a recursive call. On line 5 we make the recursive call right
3636
after the turtle turns to the right by 20 degrees; this is the right

pretext/Selection/Logicaloperators.ptx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ print(n % 2 == 0 or n % 3 == 0)
222222
</tabular>
223223
</table>
224224
<p>Also, Google has provided this short video showing different logical operators:</p>
225-
<video xml:id="GoogleLogic" youtube="57dPVbnRouU" width="667"/>
225+
<video xml:id="GoogleLogic" youtube="57dPVbnRouU" width="auto"/>
226226
<p>In the video, each letter is representative of a logical operater and only shows its color when the
227227
corresponding <term>x</term> or <term>y</term> is showing in the second <term>G</term>. If you take a look at xor, you will notice
228228
it is only colorful when either <term>x</term> or <term>y</term> is showing, but not both. This is called <c>exclusive or</c>,

pretext/SimplePythonData/Input.ptx

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,36 @@ print ( type(n) )
9595
</choice>
9696
</choices>
9797
</exercise>
98-
<exercise runestone="ca_id_ints"/>
99-
<exercise runestone="ca_id_str"/>
98+
<exercise label="test_question2_7_2">
99+
100+
<statement>
101+
<p>Click on all of the variables of type `int` in the code below</p>
102+
</statement>
103+
<areas>
104+
<cline><area correct="no">seconds</area> = input("Please enter the number of seconds you wish to convert")</cline>
105+
<p></p>
106+
<cline><area>hours</area> = int(<area correct="no">seconds</area>) // 3600</cline>
107+
<cline><area>total_secs</area> = int(<area correct="no">seconds</area>)</cline>
108+
<cline><area>secs_still_remaining</area> = <area>total_secs</area> % 3600</cline>
109+
<cline>print(<area>secs_still_remaining</area>)</cline>
110+
111+
112+
</areas>
113+
</exercise>
114+
<exercise label="test_question2_7_3">
115+
116+
<statement>
117+
<p>Click on all of the variables of type `str` in the code below</p>
118+
</statement>
119+
<areas>
120+
<cline><area>seconds</area> = input("Please enter the number of seconds you wish to convert")</cline>
121+
<p></p>
122+
<cline><area correct ="no">hours</area> = int(<area>seconds</area>) // 3600</cline>
123+
<cline><area correxct="no">total_secs</area> = int(<area>seconds</area>)</cline>
124+
<cline><area correct="no">secs_still_remaining</area> = <area correct="no">total_secs</area> % 3600</cline>
125+
<cline>print(<area correct ="no">secs_still_remaining</area>)</cline>
126+
127+
128+
</areas>
129+
</exercise>
100130
</section>

pretext/SimplePythonData/VariableNamesandKeywords.ptx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
digits, but they have to begin with a letter or an underscore. Although it is
66
legal to use uppercase letters, by convention we don't. If you do, remember
77
that case matters. <c>Bruce</c> and <c>bruce</c> are different variables.</p>
8-
<caution>
8+
<warning>
99
<p>Variable names can never contain spaces.</p>
10-
</caution>
10+
</warning>
1111
<p>The underscore character ( <c>_</c>) can also appear in a name. It is often used in
1212
names with multiple words, such as <c>my_name</c> or <c>price_of_tea_in_china</c>.
1313
There are some situations in which names beginning with an underscore have
@@ -153,7 +153,7 @@ class = "Computer Science 101"</pre>
153153
<p>Programmers generally choose names for their variables that are meaningful to
154154
the human readers of the program &#x2014; they help the programmer document, or
155155
remember, what the variable is used for.</p>
156-
<caution>
156+
<warning>
157157
<p>Beginners sometimes confuse <q>meaningful to the human readers</q> with
158158
<q>meaningful to the computer</q>. So they'll wrongly think that because
159159
they've called some variable <c>average</c> or <c>pi</c>, it will somehow
@@ -166,7 +166,7 @@ class = "Computer Science 101"</pre>
166166
the programmer, have to write some program code to calculate the average,
167167
or you must write an assignment statement to give a variable the value you
168168
want it to have.</p>
169-
</caution>
169+
</warning>
170170
<p>
171171
<term>Check your understanding</term>
172172
</p>

pretext/SimplePythonData/Variables.ptx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ pi = 3.14159
2525
17 = n
2626
</input>
2727
</program>
28-
<tip>
28+
<note>
2929
<p>When reading or writing code, say to yourself <q>n is assigned 17</q> or <q>n gets
3030
the value 17</q> or <q>n is a reference to the object 17</q> or <q>n refers to the object 17</q>. Don't say <q>n equals 17</q>.</p>
31-
</tip>
31+
</note>
3232
<p>A common way to represent variables on paper is to write the name with an arrow
3333
pointing to the variable's value. This kind of figure, known as a <term>reference diagram</term>, is often called a <term>state
3434
snapshot</term> because it shows what state each of the variables is in at a

pretext/UnitTesting/Exercises.ptx

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,6 @@ myTests().main()
6767
<p>If you're not sure how to get started with this one, review <xref ref="unit-testing_writing-unit-tests"/>.</p>
6868
</hint>
6969
<solution>
70-
assert reverse('abc') == 'cba'
71-
assert reverse('b') == 'b'
72-
assert reverse('') == ''
7370

7471
<pre>assert reverse('abc') == 'cba'
7572
assert reverse('b') == 'b'
@@ -115,13 +112,6 @@ myTests().main()
115112
<p>Review <xref ref="unit-testing_designing-testable-functions"/>.</p>
116113
</hint>
117114
<solution>
118-
def stripletters(msg):
119-
result = ''
120-
for ch in msg:
121-
if not ch.isalpha():
122-
result += ch
123-
124-
return result
125115

126116
<pre>def stripletters(msg):
127117
result = ''

pretext/WebApps/07-InputForAFlaskWebApplication.ptx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<em>python+flask</em>, and a variable named <c>go</c> whose value is <em>Submit</em>.</p>
2121
<p>Flask applications can access query variables using a dictionary named
2222
<c>request.args</c> (dictionaries are discussed in detail in
23-
<xref ref="dictionaries_intro--dictionaries"/>).
23+
<xref ref="dictionaries_dictionaries"/>).
2424
When a browser sends a request to a Flask application that contains
2525
a query string, the data in the query string is placed in the <c>request.args</c>
2626
dictionary, where it can be retrieved by the application. For example, in the Bing search

0 commit comments

Comments
 (0)