Python codes from Think Complexity by Allen B. Downey