Skip to content

Commit 80c972e

Browse files
authored
Merge pull request #253 from jdeisenberg/cs20
Eliminate Warnings on Build
2 parents fa252f6 + e96fc0c commit 80c972e

46 files changed

Lines changed: 94 additions & 99 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

pretext/Debugging/BeginningtipsforDebugging.ptx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<title>Beginning tips for Debugging</title>
44
<p>Debugging a program is a different way of thinking than writing a program. The process of debugging is much more like being a detective. Here are a few rules to get you thinking about debugging.</p>
55
<p>
6-
<ol label="1">
6+
<ol marker="1">
77
<li>
88
<p>Everyone is a suspect (Except Python)! It's common for beginner programmers to blame Python, but that should be your last resort. Remember that Python has been used to solve CS1 level problems millions of times by millions of other programmers. So, Python is probably not the problem.</p>
99
</li>

pretext/Debugging/HowtoAvoidDebugging.ptx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<title>How to Avoid Debugging</title>
44
<p>Perhaps the most important lesson in debugging is that it is <term>largely avoidable</term> &#x2013; if you work carefully.</p>
55
<p>
6-
<ol label="1">
6+
<ol marker="1">
77
<li>
88
<p><term>Understand the Problem</term> You must have a firm grasp on <term>what</term> you are trying to accomplish but not
99
necessarily <term>how</term> to do it. You do not need to understand the entire problem. But you must understand

pretext/Debugging/KnowyourerrorMessages.ptx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?xml version="1.0"?>
22
<section xml:id="debugging_know-your-error-messages">
33
<title>Know Your Error Messages</title>
4+
<introduction>
45
<p>Many problems in your program will lead to an error message. For example as I was writing and testing this chapter of the book I wrote the following version of the example program in the previous section.</p>
56
<program language="python">
67
<input>
@@ -227,10 +228,11 @@ print(final_time_int)
227228
</li>
228229
</ul>
229230
</p>
231+
</introduction>
230232
<subsection xml:id="debugging_parseerror">
231233
<title>ParseError</title>
232234
<p>Parse errors happen when you make an error in the syntax of your program. Syntax errors are like making grammatical errors in writing. If you don't use periods and commas in your writing then you are making it hard for other readers to figure out what you are trying to say. Similarly Python has certain grammatical rules that must be followed or else Python can't figure out what you are trying to say.</p>
233-
<p>Usually ParseErrors can be traced back to missing punctuation characters, such as parentheses, quotation marks, or commas. Remember that in Python commas are used to separate parameters to functions. Paretheses must be balanced, or else Python thinks that you are trying to include everything that follows as a parameter to some function.</p>
235+
<p>Usually ParseErrors can be traced back to missing punctuation characters, such as parentheses, quotation marks, or commas. Remember that in Python commas are used to separate parameters to functions. Parentheses must be balanced, or else Python thinks that you are trying to include everything that follows as a parameter to some function.</p>
234236
<p>Here are a couple examples of Parse errors in the example program we have been using. See if you can figure out what caused them.</p>
235237
<exercise>
236238
<statement/>
@@ -349,7 +351,7 @@ print(time_when_alarm_go_off)
349351
</hint>
350352
<p><term>Finding Clues</term> With name errors one of the best things you can do is use the editor, or browser search function. Quite often if you search for the exact word in the error message one of two things will happen:</p>
351353
<p>
352-
<ol label="1">
354+
<ol marker="1">
353355
<li>
354356
<p>The word you are searching for will appear only once in your code, it's also likely that it will be on the right hand side of an assignment statement, or as a parameter to a function. That should confirm for you that you have a typo somewhere. If the name in question <term>is</term> what you thought it should be then you probably have a typo on the left hand side of an assignment statement on a line before your error message occurs. Start looking backward at your assignment statements. In some cases it's really nice to leave all the highlighted strings from the search function visible as they will help you very quickly find a line where you might have expected your variable to be highlighted.</p>
355357
</li>
@@ -390,7 +392,7 @@ print(alarm_time)
390392
<title>Solution</title>
391393
<p>In this example the error message is about <c>set_time</c> not defined on line 3. In this case the undefined name is not used in an assignment statement, but is used as a parameter (incorrectly) to a function call. A search on <c>set_time</c> reveals that in fact it is only used once in the program. Did the author mean <c>set_alarm</c>? If we make that assumption we immediately get another error <c>NameError: name 'alarm_time' is not defined on line: 3</c>. The variable <c>alarm_time</c> is defined on line 4, but that does not help us on line 3. Furthermore we now have to ask the question is this function call <c>int(present_time, set_alarm, alarm_time)</c> even the correct use of the <c>int</c> function? The answer to that is a resounding no. Let's list all of the things wrong with line 3:</p>
392394
<p>
393-
<ol label="1">
395+
<ol marker="1">
394396
<li>
395397
<p><c>set_time</c> is not defined and never used, the author probably meant <c>set_alarm</c>.</p>
396398
</li>

pretext/Dictionaries/Exercises.ptx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ for char in sorted(keys):
5959
<p>Give the Python interpreter's response to each of the following from a
6060
continuous interpreter session:</p>
6161
<p>
62-
<ol label="a">
62+
<ol marker="a">
6363
<li>
6464
<program language="python">
6565
<input>

pretext/Exceptions/05_exceptions_syntax.ptx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
<?xml version="1.0"?>
22
<section xml:id="exceptions_exceptions-syntax">
33
<title>Exceptions Syntax</title>
4+
<introduction>
45
<p>There are many variations on the code that catches exceptions. Here is a
56
brief summary, but other code variations are possible.</p>
7+
</introduction>
68
<subsection xml:id="exceptions_catch-all-exceptions">
79
<title>Catch All Exceptions</title>
810
<p>Catch all exceptions, regardless of their type. This will prevent

pretext/Functions/Exercises.ptx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ drawPoly(tess, 8, 50)
122122
<exercise label="ex_5_5">
123123
<statement>
124124
<p>The two spirals in this picture differ only by the turn angle. Draw both.</p>
125-
<image source="Functions/Figures/tess_spirals.png" width="50%" height="240"/>
125+
<image source="Functions/Figures/tess_spirals.png" width="50%"/>
126126
</statement>
127127
<program interactive="activecode" language="python" xml:id="ex_5_5_editor">
128128
<input>

pretext/Functions/Functionscancallotherfunctions.ptx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ wn.exitonclick()
139139
new functions. Actually, there are a lot of reasons, but this example
140140
demonstrates two:</p>
141141
<p>
142-
<ol label="1">
142+
<ol marker="1">
143143
<li>
144144
<p>Creating a new function gives you an opportunity to name a group of
145145
statements. Functions can simplify a program by hiding a complex computation

pretext/Functions/ProgramDevelopment.ptx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ test.testEqual(distance(0,0, 1,1), 1.41)
131131
to chunk music &#x2014; from indvidual notes to chords, bars, phrases, and so on.</p>
132132
<p>The key aspects of the process are:</p>
133133
<p>
134-
<ol label="1">
134+
<ol marker="1">
135135
<li>
136136
<p>Make sure you know what you are trying to accomplish. Then you can write appropriate unit tests.</p>
137137
</li>

pretext/Functions/TheAccumulatorPattern.ptx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?xml version="1.0"?>
22
<section xml:id="functions_the-accumulator-pattern">
33
<title>The Accumulator Pattern</title>
4+
<introduction>
45
<video xml:id="function_accumulator_pattern" youtube="aqhREpceEMI" width="auto"/>
56
<p>In the previous example, we wrote a function that computes the square of a number. The algorithm we used
67
in the function was simple: multiply the number by itself.
@@ -60,6 +61,7 @@ squareResult = square(toSquare)
6061
print("The result of", toSquare, "squared is", squareResult)
6162
</input>
6263
</program>
64+
</introduction>
6365
<subsection xml:id="functions_the-general-accumulator-pattern">
6466
<title>The General Accumulator Pattern</title>
6567
<program language="python">

pretext/Functions/UnitTesting.ptx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?xml version="1.0"?>
22
<section xml:id="functions_unit-testing">
33
<title>Unit Testing</title>
4+
<introduction>
45
<p>A <term>test case</term> expresses requirements for a program, in a way that can be checked automatically. Specifically, a test
56
asserts something about the state of the program at a particular point in its execution. A <term>unit test</term> is an automatic
67
procedure used to validate that individual units of code are working properly. A function is one form of a unit.
@@ -99,6 +100,7 @@ assert type(9.0//5) == int
99100
</choice>
100101
</choices>
101102
</exercise>
103+
</introduction>
102104
<subsection xml:id="functions_assert-with-for-loops">
103105
<title><c>assert</c> with <c>for</c> loops</title>
104106
<p>Why would you ever want to write a line of code that can never compute anything useful for you, but sometimes causes

0 commit comments

Comments
 (0)