Skip to content

Commit bc30cd7

Browse files
committed
A few tweaks before publishing draft
1 parent a49044f commit bc30cd7

21 files changed

+454
-730
lines changed

book/03-conditional.mkd

+4-4
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ This flexibility can be useful, but there are some subtleties to it that
103103
might be confusing. You might want to avoid it until you are sure you
104104
know what you are doing.
105105

106-
Conditional execution {#conditional execution}
106+
Conditional execution
107107
---------------------
108108

109109
\index{conditional statement}
@@ -171,7 +171,7 @@ Small
171171
>>>
172172
~~~~
173173

174-
Alternative execution {#alternative execution}
174+
Alternative execution
175175
---------------------
176176

177177
\index{alternative execution}
@@ -299,7 +299,7 @@ if 0 < x and x < 10:
299299
print('x is a positive single-digit number.')
300300
~~~~
301301

302-
Catching exceptions using try and except {#catch1}
302+
Catching exceptions using try and except
303303
----------------------------------------
304304

305305
Earlier we saw a code segment where we used the `raw_input` and
@@ -477,7 +477,7 @@ In the second expression, we say that `y != 0` acts as a
477477
*guard* to insure that we only execute `(x/y)`
478478
if `y` is non-zero.
479479

480-
Debugging {#whitespace}
480+
Debugging
481481
---------
482482

483483
\index{debugging}

book/04-functions.mkd

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
Functions {#funcchap}
1+
2+
Functions
23
=========
34

4-
Function calls {#functionchap}
5+
Function calls
56
--------------
67

78
\index{function call}
@@ -486,7 +487,7 @@ What's the moral of this sordid tale? When you read a program, you don't
486487
always want to read from top to bottom. Sometimes it makes more sense if
487488
you follow the flow of execution.
488489

489-
Parameters and arguments {#parameters}
490+
Parameters and arguments
490491
------------------------
491492

492493
\index{parameter}
@@ -678,7 +679,7 @@ finds the smallest in a list of values and we will present it to you as
678679
a function named `min` which takes a list of values as its
679680
argument and returns the smallest value in the list.
680681

681-
Debugging {#editor}
682+
Debugging
682683
---------
683684

684685
\index{debugging}

book/05-iterations.mkd

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ Iteration
44

55
\index{iteration}
66

7-
8-
Updating variables {#update}
7+
Updating variables
98
------------------
109

1110
\index{update}

book/06-strings.mkd

+4-4
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ on.
112112
\index{index!negative}
113113
\index{negative index}
114114

115-
Traversal through a string with a loop {#for}
115+
Traversal through a string with a loop
116116
--------------------------------------
117117

118118
\index{traversal}
@@ -159,7 +159,7 @@ Each time through the loop, the next character in the string is assigned
159159
to the variable `char`. The loop continues until no
160160
characters are left.
161161

162-
String slices {#slice}
162+
String slices
163163
-------------
164164

165165
\index{slice operator}
@@ -259,7 +259,7 @@ This example concatenates a new first letter onto a slice of
259259

260260
\index{concatenation}
261261

262-
Looping and counting {#counter}
262+
Looping and counting
263263
--------------------
264264

265265
\index{counter}
@@ -292,7 +292,7 @@ Exercise 3:
292292
Encapsulate this code in a function named `count`, and
293293
generalize it so that it accepts the string and the letter as arguments.
294294

295-
The `in` operator {#inboth}
295+
The `in` operator
296296
----------------------------
297297

298298
\index{in operator}

book/09-dictionaries.mkd

+2-2
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ stores them as keys in a dictionary. It doesn't matter what the values
135135
are. Then you can use the `in` operator as a fast way to
136136
check whether a string is in the dictionary.
137137

138-
Dictionary as a set of counters {#histogram}
138+
Dictionary as a set of counters
139139
-------------------------------
140140

141141
\index{counter}
@@ -634,4 +634,4 @@ python schoolcount.py
634634
Enter a file name: mbox-short.txt
635635
{'media.berkeley.edu': 4, 'uct.ac.za': 6, 'umich.edu': 7,
636636
'gmail.com': 1, 'caret.cam.ac.uk': 1, 'iupui.edu': 8}
637-
~~~~
637+
~~~~

book/10-tuples.mkd

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
Tuples {#tuplechap}
1+
2+
Tuples
23
======
34

45
Tuples are immutable
@@ -205,7 +206,7 @@ The output of the program is as follows:
205206
Of course the line loses much of its poetic impact when turned into a
206207
Python list and sorted in descending word length order.
207208

208-
Tuple assignment {#tuple assignment}
209+
Tuple assignment
209210
----------------
210211

211212
\index{tuple!assignment}

book/11-regex.mkd

+2-2
Original file line numberDiff line numberDiff line change
@@ -541,8 +541,8 @@ of a word.
541541
`\\`D Matches any non-digit character; equivalent to the set
542542
[`^`0-9].
543543

544-
Bonus section for Unix users
545-
----------------------------
544+
Bonus section for Unix / Linux users
545+
------------------------------------
546546

547547
Support for searching files using regular expressions was built into the
548548
Unix operating system since the 1960s and it is available in nearly all

book/AC-contrib.mkd

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
12
Contributions
23
=============
34

4-
Contributor List for "Python for Informatics" {#contributor-list-for-python-for-informatics .unnumbered}
5-
---------------------------------------------
5+
Contributor List for Python for Informatics
6+
-------------------------------------------
67

78
Bruce Shields for copy editing early drafts, Sarah Hegge, Steven Cherry,
89
Sarah Kathleen Barbarow, Andrea Parker, Radaphat Chongthammakun, Megan
@@ -14,10 +15,10 @@ Thomas Strassel, Ryan Clement, Alissa Talley, Caitlin Holman, Yong-Mi
1415
Kim, Karen Stover, Cherie Edmonds, Maria Seiferle, Romer Kristi D.
1516
Aranas (RK), Grant Boyer, Hedemarrie Dussan,
1617

17-
Preface for "Think Python" {#preface-for-think-python .unnumbered}
18+
Preface for "Think Python"
1819
--------------------------
1920

20-
### The strange history of "Think Python" {#the-strange-history-of-think-python .unnumbered}
21+
### The strange history of "Think Python"
2122

2223
(Allen B. Downey)
2324

@@ -89,7 +90,7 @@ who was interested in publishing the next edition. Good timing!
8990
I hope you enjoy working with this book, and that it helps you learn to
9091
program and think, at least a little bit, like a computer scientist.
9192

92-
### Acknowledgements for "Think Python" {#acknowledgements-for-think-python .unnumbered}
93+
### Acknowledgements for "Think Python"
9394

9495
(Allen B. Downey)
9596

@@ -123,7 +124,7 @@ Needham MA\
123124
Allen Downey is an Associate Professor of Computer Science at the
124125
Franklin W. Olin College of Engineering.
125126

126-
Contributor List for "Think Python" {#contributor-list-for-think-python .unnumbered}
127+
Contributor List for "Think Python"
127128
-----------------------------------
128129

129130
\index{contributors}

book/book.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ sed < tmp.prefacex.tex 's/section{/section*{/' > tmp.preface.tex
1010
cat [0-9]*.mkd | python verbatim.py | tee tmp.verbatim | pandoc -s -N -f markdown+definition_lists -t latex --toc --default-image-extension=eps -V fontsize:10pt -V documentclass:book --template=template.latex -o tmp.tex
1111

1212
pandoc [A-Z][A-Z]*.mkd -o tmp.app.tex
13-
sed < tmp.app.tex 's/section{/chapter{/' > tmp.appendix.tex
13+
sed < tmp.app.tex -e 's/subsubsection{/xyzzy{/' -e 's/subsection{/plugh{/' -e 's/section{/chapter{/' -e 's/xyzzy{/subsection{/' -e 's/plugh{/section{/' > tmp.appendix.tex
1414

1515
sed < tmp.tex '/includegraphics/s/jpg/eps/' | sed 's"includegraphics{../photos"includegraphics[height=3.0in]{../photos"' > tmp.sed
1616
diff tmp.sed tmp.tex

figures/elif.graffle

15 Bytes
Binary file not shown.

figures/if-else.graffle

10 Bytes
Binary file not shown.

figures/if.graffle

9 Bytes
Binary file not shown.

figures/nested.graffle

13 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)