Solutions to other tests:
  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17  

Mathematics for the Digital Age
and
Programming in Python


>>> Second Edition

Test 3

1.
(a), (b), (d), (e)
2.
(a) T   (b) F   (c) T  
3.
(a), (b), (c)
4.
(a) T   (b) T   (c) T  
5.
D
6.
(a), (c)
7.
C
8.
C
9.
B
10.
B
11.
A
12.
(a) T   (b) F   (c) T
13.
D
14.
C
15.
(a) T   (b) T   (c) F
16.
A
17.
(a) T   (b) F   (c) T   (d) F
18.
D
19.
B
20.
B

21.
10 * '*' + s + 10 * '*'
22.
def someTan(x):
    t = math.tan(x)
    return t / (1 - t**2)
23.
def printA(): print(' A ') print(' A A ') print(' AAAAA ') print('A A')
24.
def heron(a, b, c): '''Uses Heron's formula to calculate the area of a triangle with given lengths of its sides, a, b, and c; returns the area.''' s = (a + b + c) / 2 return sqrt(s * (s - a) * (s - b) * (s - c))
25.
def first_digit(n): s = str(n) return int(s[0])
26.
def swap(lst): temp = lst[0] lst[0] = lst[-1] lst[-1] = temp or def swap(lst): lst[0], lst[-1] = lst[-1], lst[0]




Copyright © 2010 by Skylight Publishing