Answers to Exercises
Note: Almost all the exercises have many possible correct answers; what’s listed here are merely sample correct answers.
1 | Starting Out: Elementary Arithmetic |
1.1
1.2
1.3
1.4
1.5
1.6
1.7
1.8
1.9
+1.1
+1.2
+1.3
+1.4
+1.5
+1.6
+1.7
+1.8
2 | Introducing Functions |
2.1
2.2
2.3
2.4
2.5
+2.1
+2.2
+2.3
+2.4
+2.5
+2.6
+2.7
+2.8
3 | First Look at Lists |
3.1
3.2
3.3
3.4
3.5
3.6
3.7
3.8
3.9
3.10
3.11
+3.1
+3.2
+3.3
+3.4
+3.5
4 | Displaying Lists |
4.1
4.2
4.3
4.4
4.5
4.6
4.7
+4.1
+4.2
+4.3
+4.4
+4.5
+4.6
5 | Operations on Lists |
5.1
5.2
5.3
5.4
5.5
5.6
5.7
5.8
5.9
5.10
5.11
5.12
5.13
5.14
+5.1
+5.2
+5.3
+5.4
+5.5
+5.6
+5.7
6 | Making Tables |
6.1
6.2
6.3
6.4
6.5
6.6
6.7
6.8
6.9
6.10
+6.1
+6.2
+6.3
+6.4
+6.5
+6.6
+6.7
+6.8
+6.9
+6.10
+6.11
7 | Colors and Styles |
7.1
7.2
7.3
7.4
7.5
7.6
7.7
7.8
7.9
7.10
7.11
7.12
7.13
7.14
+7.1
+7.2
+7.3
+7.4
+7.5
+7.6
+7.7
+7.8
+7.9
8 | Basic Graphics Objects |
8.1
8.2
8.3
8.4
8.5
8.6
8.7
8.8
+8.1
+8.2
+8.3
9 | Interactive Manipulation |
9.1
9.2
9.3
9.4
9.5
9.6
9.7
9.8
9.9
9.10
9.11
9.12
9.13
9.14
9.15
+9.1
+9.2
+9.3
10 | Images |
10.1
10.2
10.3
10.4
10.5
10.6
10.7
10.8
10.9
10.10
10.11
10.12
10.13
10.14
+10.1
+10.2
+10.3
+10.4
11 | Strings and Text |
11.1
11.2
11.3
11.4
11.5
11.6
11.7
11.8
11.9
11.10
11.11
11.12
11.13
11.14
11.15
11.16
11.17
11.18
11.19
11.20
11.21
11.22
11.23
11.24
11.25
11.26
11.27
11.28
11.29
11.30
+11.1
+11.2
+11.3
+11.4
+11.5
+11.6
+11.7
+11.8
+11.9
+11.10
+11.11
+11.12
+11.13
12 | Sound |
12.1
12.2
12.3
12.4
12.5
12.6
12.7
12.8
12.9
12.10
+12.1
+12.2
+12.3
+12.4
13 | Arrays, or Lists of Lists |
13.1
13.2
13.3
13.4
13.5
13.6
13.7
13.8
13.9
+13.1
+13.2
14 | Coordinates and Graphics |
14.1
14.2
14.3
14.4
14.5
14.6
14.7
14.8
14.9
14.10
+14.1
+14.2
+14.3
+14.4
+14.5
+14.6
16 | Real‐World Data |
16.1
16.2
16.3
16.4
16.5
16.6
16.7
16.8
16.9
16.10
16.11
16.12
16.13
+16.1
+16.2
+16.3
17 | Units |
17.1
17.2
17.3
17.4
17.5
17.6
17.7
17.8
17.9
17.10
17.11
17.12
17.13
17.14
+17.1
+17.2
+17.3
+17.4
+17.5
+17.6
18 | Geocomputation |
18.1
18.2
18.3
18.4
18.5
18.6
18.7
18.8
18.9
18.10
18.11
18.12
+18.1
+18.2
+18.3
+18.4
+18.5
+18.6
+18.7
19 | Dates and Times |
19.1
19.2
19.3
19.4
19.5
19.6
19.7
19.8
19.9
19.10
19.11
19.12
19.13
+19.1
+19.2
+19.3
+19.4
+19.5
+19.6
+19.7
20 | Options |
20.1
20.2
20.3
20.4
20.5
20.6
20.7
20.8
20.9
20.10
20.11
20.12
20.13
+20.1
+20.2
+20.3
+20.4
+20.5
+20.6
+20.7
+20.8
21 | Graphs and Networks |
21.1
21.2
21.3
21.4
21.5
21.6
21.7
21.8
21.9
21.10
21.11
+21.1
+21.2
+21.3
+21.4
+21.5
+21.6
+21.7
22 | Machine Learning |
22.1
22.2
22.3
22.4
22.5
22.6
22.7
22.8
22.9
22.10
22.11
22.12
22.13
22.14
22.15
22.16
+22.1
+22.2
+22.3
+22.4
+22.5
+22.6
+22.7
23 | More about Numbers |
23.1
23.2
23.3
23.4
23.5
23.6
23.7
23.8
23.9
23.10
23.11
23.12
23.13
23.14
+23.1
+23.2
+23.3
+23.4
24 | More Forms of Visualization |
24.1
24.2
24.3
24.4
24.5
24.6
24.7
24.8
24.9
24.10
24.11
+24.1
25 | Ways to Apply Functions |
25.1
25.2
25.3
25.4
25.5
25.6
25.7
25.8
25.9
26 | Pure Anonymous Functions |
26.1
26.2
26.3
26.4
26.5
26.6
26.7
26.8
+26.1
27 | Applying Functions Repeatedly |
27.1
27.2
27.3
27.4
27.5
27.6
27.7
27.8
27.9
27.10
27.11
+27.1
+27.2
+27.3
+27.4
+27.5
28 | Tests and Conditionals |
28.1
28.2
28.3
28.4
28.5
28.6
28.7
28.8
28.9
28.10
28.11
28.12
28.13
+28.1
+28.2
+28.3
+28.4
+28.5
+28.6
+28.7
29 | More about Pure Functions |
29.1
29.2
29.3
29.4
29.5
29.6
+29.1
30 | Rearranging Lists |
30.1
30.2
30.3
30.4
30.5
30.6
30.7
30.8
30.9
30.10
30.11
30.12
30.13
30.14
30.15
30.16
30.17
30.18
30.19
30.20
30.21
+30.1
+30.2
+30.3
+30.4
+30.5
+30.6
+30.7
+30.8
+30.9
+30.10
+30.11
+30.12
+30.13
31 | Parts of Lists |
31.1
31.2
31.3
31.4
31.5
31.6
31.7
31.8
31.9
31.10
31.11
31.12
31.13
32 | Patterns |
32.1
32.2
32.3
32.4
32.5
32.6
32.7
32.8
33 | Expressions and Their Structure |
33.1
33.2
33.3
33.4
33.5
33.6
33.7
33.8
34 | Associations |
34.1
34.2
34.3
34.4
34.5
34.6
35 | Natural Language Understanding |
35.1
35.2
35.3
35.4
35.5
35.6
35.7
35.8
35.9
35.10
35.11
35.12
35.13
35.14
35.15
36 | Creating Websites and Apps |
36.1
36.2
36.3
36.4
36.5
36.6
36.7
36.8
36.9
+36.1
+36.2
37 | Layout and Display |
37.1
37.2
37.3
37.4
37.5
37.6
37.7
37.8
38 | Assigning Names to Things |
38.1
38.2
38.3
38.4
38.5
38.6
38.7
39 | Immediate and Delayed Values |
39.1
39.2
40 | Defining Your Own Functions |
40.1
40.2
40.3
40.4
40.5
40.6
40.7
40.8
40.9
40.10
41 | More about Patterns |
41.1
41.2
41.3
41.4
41.5
41.6
41.7
41.8
41.9
41.10
41.11
41.12
42 | String Patterns and Templates |
42.1
42.2
42.3
42.4
42.5
42.6
42.7
42.8
44 | Importing and Exporting |
44.1
44.2
44.3
44.4
44.5
44.6
44.7
44.8
44.9
45 | Datasets |
45.1
45.2
45.3
45.4
45.5
45.6
45.7
45.8
45.9
45.10
45.11
45.12
45.13
46 | Writing Good Code |
46.1
46.2
46.3
46.4
46.5
47 | Debugging Your Code |
47.1
47.2
47.3