How to Think Like a Computer Scientist: Learning with Python 2nd Edition/Solutions/CH 10

CH 10 - Solution 1.2
isleap(year) - Return 1 for leap years, 0 for non-leap years.

CH 10 - Solution 2.1
python C:\Python26\Lib\pydoc.py -p 7464

CH 10 - Solution 2.2
There are 35 functions in the math module.

CH 10 - Solution 2.3
The floor function finds the greatest integral value less than or equal to x. The ceil function finds the lowest integeral value greater than or equal to x.

CH 10 - Solution 2.5
The two data constants in the math module are: 'e' and 'pi'.

CH 10 - Solution 3
deepcopy would have come handy in exercises you didn't have to solve regarding object reference, thus no answer is excpected here.

CH 10 - Solution 6
Namespaces are one honking great idea -- let's do more of those!

CH 10 - Solution 8
def matrix_mult(m1, m2): """     >>> matrix_mult(1, 2], [3,  4, 5, 6], [7, 8)      19, 22], [43, 50      >>> matrix_mult(1, 2, 3], [4,  5, 6, 7, 8], [9, 1], [2, 3)      31, 19], [85, 55      >>> matrix_mult(7, 8], [9, 1], [2, 3, 1, 2, 3], [4, 5, 6)      39, 54, 69], [13, 23, 33], [14, 19, 24    """ qr = len(m1) qc = len(m2[0]) NewMtx = [] for row in range(qr): newRow = [] for column in range(qc): newRow.append(row_times_column(m1, row, m2, column)) NewMtx.append(newRow) return NewMtx return NewMtx qr = len(m1) qc = len(m2[0]) NewMtx = [] for row in range(qr): newRow = [] for column in range(qc): newRow.append(row_times_column(m1, row, m2, column)) NewMtx.append(newRow)