Chapter 3
Contents:
True/False
|
Multiple Choice
|
Discussion
|
Programs
True/False
True
False
False
True
False
False
True
True
False
False
Multiple Choice
c
d
d
b
b
c
d
b
a
d
Discussion
"By hand" values may differ slightly from Python output (shown in parenthesis).
7.4 (7.4000000000000004)
5
8
illegal because sqrt cannot handle negative arguments
11
27L
Answers may vary as long as the expressions are equivalent.
(3 + 4) * 5
(n * (n-1)) / 2
4 * math.pi * r**2
math.sqrt(r * math.cos(a)**2 + r * math.sin(a)**2)
(y2 - y1) / (x2 - x1)
These can be checked interactively.
[0, 1, 2, 3, 4]
[3, 4, 5, 6, 7, 8, 9]
[4, 7, 10]
[15, 13, 11, 9, 7]
[]
These can be checked interactively.
0
1
4
9
16
25
36
49
64
81
100
1 : 1
3 : 27
5 : 125
7 : 343
9 : 729
9
0 12
2 12
4 12
6 12
8 12
done
1
2
3
4
5
6
7
8
9
10
385
Programming Exercises
Code for Chapter 3 Exercises