Skip to content

Commit 72bc9be

Browse files
authored
Merge pull request #3 from gjbex/development
Development
2 parents 4bd8219 + f6a8f58 commit 72bc9be

27 files changed

+8664
-3
lines changed

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# direnv configuration file
2+
.envrc
3+
4+
# editor backup files
5+
*~
6+
*.bak
7+
8+
# checkpoint directory
9+
.ipynb_checkpoints/

environment.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
name: python_for_programmers
2+
channels:
3+
- defaults
4+
dependencies:
5+
- python
6+
- jupyterlab
7+
- matplotlib
8+
prefix: /home/gjb/miniconda3/envs/python_for_programmers
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
# This file may be used to create an environment using:
2+
# $ conda create --name <env> --file <this file>
3+
# platform: linux-64
4+
@EXPLICIT
5+
https://repo.anaconda.com/pkgs/main/linux-64/_libgcc_mutex-0.1-main.conda
6+
https://repo.anaconda.com/pkgs/main/linux-64/blas-1.0-mkl.conda
7+
https://repo.anaconda.com/pkgs/main/linux-64/ca-certificates-2022.4.26-h06a4308_0.conda
8+
https://repo.anaconda.com/pkgs/main/linux-64/intel-openmp-2021.4.0-h06a4308_3561.conda
9+
https://repo.anaconda.com/pkgs/main/linux-64/ld_impl_linux-64-2.38-h1181459_1.conda
10+
https://repo.anaconda.com/pkgs/main/linux-64/libstdcxx-ng-11.2.0-h1234567_0.conda
11+
https://repo.anaconda.com/pkgs/main/noarch/tzdata-2022a-hda174b7_0.conda
12+
https://repo.anaconda.com/pkgs/main/linux-64/libgomp-11.2.0-h1234567_0.conda
13+
https://repo.anaconda.com/pkgs/main/linux-64/mkl-2021.4.0-h06a4308_640.conda
14+
https://repo.anaconda.com/pkgs/main/linux-64/_openmp_mutex-5.1-1_gnu.conda
15+
https://repo.anaconda.com/pkgs/main/linux-64/libgcc-ng-11.2.0-h1234567_0.conda
16+
https://repo.anaconda.com/pkgs/main/linux-64/brotli-1.0.9-he6710b0_2.conda
17+
https://repo.anaconda.com/pkgs/main/linux-64/bzip2-1.0.8-h7b6447c_0.conda
18+
https://repo.anaconda.com/pkgs/main/linux-64/expat-2.4.4-h295c915_0.conda
19+
https://repo.anaconda.com/pkgs/main/linux-64/giflib-5.2.1-h7b6447c_0.conda
20+
https://repo.anaconda.com/pkgs/main/linux-64/icu-58.2-he6710b0_3.conda
21+
https://repo.anaconda.com/pkgs/main/linux-64/jpeg-9e-h7f8727e_0.conda
22+
https://repo.anaconda.com/pkgs/main/linux-64/libffi-3.3-he6710b0_2.conda
23+
https://repo.anaconda.com/pkgs/main/linux-64/libsodium-1.0.18-h7b6447c_0.conda
24+
https://repo.anaconda.com/pkgs/main/linux-64/libuuid-1.0.3-h7f8727e_2.conda
25+
https://repo.anaconda.com/pkgs/main/linux-64/libwebp-base-1.2.2-h7f8727e_0.conda
26+
https://repo.anaconda.com/pkgs/main/linux-64/libxcb-1.15-h7f8727e_0.conda
27+
https://repo.anaconda.com/pkgs/main/linux-64/lz4-c-1.9.3-h295c915_1.conda
28+
https://repo.anaconda.com/pkgs/main/linux-64/ncurses-6.3-h7f8727e_2.conda
29+
https://repo.anaconda.com/pkgs/main/linux-64/openssl-1.1.1o-h7f8727e_0.conda
30+
https://repo.anaconda.com/pkgs/main/linux-64/pcre-8.45-h295c915_0.conda
31+
https://repo.anaconda.com/pkgs/main/linux-64/xz-5.2.5-h7f8727e_1.conda
32+
https://repo.anaconda.com/pkgs/main/linux-64/zlib-1.2.12-h7f8727e_2.conda
33+
https://repo.anaconda.com/pkgs/main/linux-64/glib-2.69.1-h4ff587b_1.conda
34+
https://repo.anaconda.com/pkgs/main/linux-64/libpng-1.6.37-hbc83047_0.conda
35+
https://repo.anaconda.com/pkgs/main/linux-64/libxml2-2.9.12-h74e7548_2.conda
36+
https://repo.anaconda.com/pkgs/main/linux-64/readline-8.1.2-h7f8727e_1.conda
37+
https://repo.anaconda.com/pkgs/main/linux-64/tk-8.6.11-h1ccaba5_1.conda
38+
https://repo.anaconda.com/pkgs/main/linux-64/zeromq-4.3.4-h2531618_0.conda
39+
https://repo.anaconda.com/pkgs/main/linux-64/zstd-1.5.2-ha4553b6_0.conda
40+
https://repo.anaconda.com/pkgs/main/linux-64/dbus-1.13.18-hb2f20db_0.conda
41+
https://repo.anaconda.com/pkgs/main/linux-64/freetype-2.11.0-h70c0345_0.conda
42+
https://repo.anaconda.com/pkgs/main/linux-64/gstreamer-1.14.0-h28cd5cc_2.conda
43+
https://repo.anaconda.com/pkgs/main/linux-64/libtiff-4.2.0-h2818925_1.conda
44+
https://repo.anaconda.com/pkgs/main/linux-64/sqlite-3.38.3-hc218d9a_0.conda
45+
https://repo.anaconda.com/pkgs/main/linux-64/fontconfig-2.13.1-h6c09931_0.conda
46+
https://repo.anaconda.com/pkgs/main/linux-64/gst-plugins-base-1.14.0-h8213a91_2.conda
47+
https://repo.anaconda.com/pkgs/main/linux-64/lcms2-2.12-h3be6417_0.conda
48+
https://repo.anaconda.com/pkgs/main/linux-64/libwebp-1.2.2-h55f646e_0.conda
49+
https://repo.anaconda.com/pkgs/main/linux-64/python-3.10.4-h12debd9_0.tar.bz2
50+
https://repo.anaconda.com/pkgs/main/noarch/attrs-21.4.0-pyhd3eb1b0_0.conda
51+
https://repo.anaconda.com/pkgs/main/noarch/backcall-0.2.0-pyhd3eb1b0_0.tar.bz2
52+
https://repo.anaconda.com/pkgs/main/linux-64/certifi-2022.5.18.1-py310h06a4308_0.conda
53+
https://repo.anaconda.com/pkgs/main/noarch/charset-normalizer-2.0.4-pyhd3eb1b0_0.conda
54+
https://repo.anaconda.com/pkgs/main/noarch/cycler-0.11.0-pyhd3eb1b0_0.conda
55+
https://repo.anaconda.com/pkgs/main/linux-64/debugpy-1.5.1-py310h295c915_0.conda
56+
https://repo.anaconda.com/pkgs/main/noarch/decorator-5.1.1-pyhd3eb1b0_0.conda
57+
https://repo.anaconda.com/pkgs/main/noarch/defusedxml-0.7.1-pyhd3eb1b0_0.conda
58+
https://repo.anaconda.com/pkgs/main/linux-64/entrypoints-0.4-py310h06a4308_0.conda
59+
https://repo.anaconda.com/pkgs/main/noarch/executing-0.8.3-pyhd3eb1b0_0.conda
60+
https://repo.anaconda.com/pkgs/main/noarch/idna-3.3-pyhd3eb1b0_0.conda
61+
https://repo.anaconda.com/pkgs/main/noarch/ipython_genutils-0.2.0-pyhd3eb1b0_1.conda
62+
https://repo.anaconda.com/pkgs/main/noarch/json5-0.9.6-pyhd3eb1b0_0.conda
63+
https://repo.anaconda.com/pkgs/main/linux-64/kiwisolver-1.3.1-py310h295c915_0.conda
64+
https://repo.anaconda.com/pkgs/main/linux-64/markupsafe-2.0.1-py310h7f8727e_0.conda
65+
https://repo.anaconda.com/pkgs/main/linux-64/mistune-0.8.4-py310h7f8727e_1000.conda
66+
https://repo.anaconda.com/pkgs/main/noarch/munkres-1.1.4-py_0.conda
67+
https://repo.anaconda.com/pkgs/main/linux-64/nest-asyncio-1.5.5-py310h06a4308_0.conda
68+
https://repo.anaconda.com/pkgs/main/noarch/pandocfilters-1.5.0-pyhd3eb1b0_0.conda
69+
https://repo.anaconda.com/pkgs/main/noarch/parso-0.8.3-pyhd3eb1b0_0.conda
70+
https://repo.anaconda.com/pkgs/main/noarch/pickleshare-0.7.5-pyhd3eb1b0_1003.conda
71+
https://repo.anaconda.com/pkgs/main/linux-64/pillow-9.0.1-py310h22f2fdc_0.conda
72+
https://repo.anaconda.com/pkgs/main/noarch/prometheus_client-0.13.1-pyhd3eb1b0_0.conda
73+
https://repo.anaconda.com/pkgs/main/noarch/ptyprocess-0.7.0-pyhd3eb1b0_2.conda
74+
https://repo.anaconda.com/pkgs/main/noarch/pure_eval-0.2.2-pyhd3eb1b0_0.conda
75+
https://repo.anaconda.com/pkgs/main/noarch/pycparser-2.21-pyhd3eb1b0_0.conda
76+
https://repo.anaconda.com/pkgs/main/noarch/pygments-2.11.2-pyhd3eb1b0_0.conda
77+
https://repo.anaconda.com/pkgs/main/noarch/pyparsing-3.0.4-pyhd3eb1b0_0.conda
78+
https://repo.anaconda.com/pkgs/main/linux-64/pyrsistent-0.18.0-py310h7f8727e_0.conda
79+
https://repo.anaconda.com/pkgs/main/linux-64/pysocks-1.7.1-py310h06a4308_0.conda
80+
https://repo.anaconda.com/pkgs/main/noarch/python-fastjsonschema-2.15.1-pyhd3eb1b0_0.conda
81+
https://repo.anaconda.com/pkgs/main/noarch/pytz-2021.3-pyhd3eb1b0_0.conda
82+
https://repo.anaconda.com/pkgs/main/linux-64/pyzmq-22.3.0-py310h295c915_2.conda
83+
https://repo.anaconda.com/pkgs/main/linux-64/qt-5.9.7-h5867ecd_1.conda
84+
https://repo.anaconda.com/pkgs/main/noarch/send2trash-1.8.0-pyhd3eb1b0_1.conda
85+
https://repo.anaconda.com/pkgs/main/linux-64/sip-4.19.13-py310h295c915_0.conda
86+
https://repo.anaconda.com/pkgs/main/noarch/six-1.16.0-pyhd3eb1b0_1.conda
87+
https://repo.anaconda.com/pkgs/main/linux-64/sniffio-1.2.0-py310h06a4308_1.conda
88+
https://repo.anaconda.com/pkgs/main/noarch/soupsieve-2.3.1-pyhd3eb1b0_0.conda
89+
https://repo.anaconda.com/pkgs/main/noarch/testpath-0.5.0-pyhd3eb1b0_0.conda
90+
https://repo.anaconda.com/pkgs/main/linux-64/tornado-6.1-py310h7f8727e_0.conda
91+
https://repo.anaconda.com/pkgs/main/noarch/traitlets-5.1.1-pyhd3eb1b0_0.conda
92+
https://repo.anaconda.com/pkgs/main/noarch/typing_extensions-4.1.1-pyh06a4308_0.conda
93+
https://repo.anaconda.com/pkgs/main/noarch/wcwidth-0.2.5-pyhd3eb1b0_0.conda
94+
https://repo.anaconda.com/pkgs/main/linux-64/webencodings-0.5.1-py310h06a4308_1.conda
95+
https://repo.anaconda.com/pkgs/main/noarch/wheel-0.37.1-pyhd3eb1b0_0.conda
96+
https://repo.anaconda.com/pkgs/main/linux-64/anyio-3.5.0-py310h06a4308_0.conda
97+
https://repo.anaconda.com/pkgs/main/noarch/asttokens-2.0.5-pyhd3eb1b0_0.conda
98+
https://repo.anaconda.com/pkgs/main/noarch/babel-2.9.1-pyhd3eb1b0_0.conda
99+
https://repo.anaconda.com/pkgs/main/linux-64/beautifulsoup4-4.11.1-py310h06a4308_0.conda
100+
https://repo.anaconda.com/pkgs/main/linux-64/cffi-1.15.0-py310hd667e15_1.conda
101+
https://repo.anaconda.com/pkgs/main/noarch/fonttools-4.25.0-pyhd3eb1b0_0.conda
102+
https://repo.anaconda.com/pkgs/main/linux-64/jedi-0.18.1-py310h06a4308_1.conda
103+
https://repo.anaconda.com/pkgs/main/noarch/jinja2-3.0.3-pyhd3eb1b0_0.conda
104+
https://repo.anaconda.com/pkgs/main/linux-64/jsonschema-4.4.0-py310h06a4308_0.conda
105+
https://repo.anaconda.com/pkgs/main/linux-64/jupyter_core-4.10.0-py310h06a4308_0.conda
106+
https://repo.anaconda.com/pkgs/main/noarch/jupyterlab_pygments-0.1.2-py_0.conda
107+
https://repo.anaconda.com/pkgs/main/noarch/matplotlib-inline-0.1.2-pyhd3eb1b0_2.conda
108+
https://repo.anaconda.com/pkgs/main/linux-64/mkl-service-2.4.0-py310h7f8727e_0.conda
109+
https://repo.anaconda.com/pkgs/main/noarch/packaging-21.3-pyhd3eb1b0_0.conda
110+
https://repo.anaconda.com/pkgs/main/noarch/pexpect-4.8.0-pyhd3eb1b0_3.conda
111+
https://repo.anaconda.com/pkgs/main/noarch/prompt-toolkit-3.0.20-pyhd3eb1b0_0.conda
112+
https://repo.anaconda.com/pkgs/main/linux-64/pyqt-5.9.2-py310h295c915_6.conda
113+
https://repo.anaconda.com/pkgs/main/noarch/python-dateutil-2.8.2-pyhd3eb1b0_0.conda
114+
https://repo.anaconda.com/pkgs/main/linux-64/setuptools-61.2.0-py310h06a4308_0.conda
115+
https://repo.anaconda.com/pkgs/main/linux-64/terminado-0.13.1-py310h06a4308_0.conda
116+
https://repo.anaconda.com/pkgs/main/noarch/typing-extensions-4.1.1-hd3eb1b0_0.conda
117+
https://repo.anaconda.com/pkgs/main/linux-64/websocket-client-0.58.0-py310h06a4308_4.conda
118+
https://repo.anaconda.com/pkgs/main/linux-64/argon2-cffi-bindings-21.2.0-py310h7f8727e_0.conda
119+
https://repo.anaconda.com/pkgs/main/noarch/bleach-4.1.0-pyhd3eb1b0_0.conda
120+
https://repo.anaconda.com/pkgs/main/linux-64/brotlipy-0.7.0-py310h7f8727e_1002.conda
121+
https://repo.anaconda.com/pkgs/main/linux-64/cryptography-37.0.1-py310h9ce1e76_0.conda
122+
https://repo.anaconda.com/pkgs/main/linux-64/jupyter_client-7.2.2-py310h06a4308_0.conda
123+
https://repo.anaconda.com/pkgs/main/linux-64/nbformat-5.3.0-py310h06a4308_0.conda
124+
https://repo.anaconda.com/pkgs/main/linux-64/numpy-base-1.22.3-py310h9585f30_0.conda
125+
https://repo.anaconda.com/pkgs/main/linux-64/pip-21.2.4-py310h06a4308_0.conda
126+
https://repo.anaconda.com/pkgs/main/noarch/stack_data-0.2.0-pyhd3eb1b0_0.conda
127+
https://repo.anaconda.com/pkgs/main/noarch/argon2-cffi-21.3.0-pyhd3eb1b0_0.conda
128+
https://repo.anaconda.com/pkgs/main/linux-64/ipython-8.3.0-py310h06a4308_0.conda
129+
https://repo.anaconda.com/pkgs/main/linux-64/nbclient-0.5.13-py310h06a4308_0.conda
130+
https://repo.anaconda.com/pkgs/main/noarch/pyopenssl-22.0.0-pyhd3eb1b0_0.conda
131+
https://repo.anaconda.com/pkgs/main/linux-64/ipykernel-6.9.1-py310h06a4308_0.conda
132+
https://repo.anaconda.com/pkgs/main/linux-64/nbconvert-6.4.4-py310h06a4308_0.conda
133+
https://repo.anaconda.com/pkgs/main/linux-64/urllib3-1.26.9-py310h06a4308_0.conda
134+
https://repo.anaconda.com/pkgs/main/noarch/jupyter_server-1.13.5-pyhd3eb1b0_0.conda
135+
https://repo.anaconda.com/pkgs/main/linux-64/notebook-6.4.11-py310h06a4308_0.conda
136+
https://repo.anaconda.com/pkgs/main/noarch/requests-2.27.1-pyhd3eb1b0_0.conda
137+
https://repo.anaconda.com/pkgs/main/linux-64/jupyterlab_server-2.12.0-py310h06a4308_0.conda
138+
https://repo.anaconda.com/pkgs/main/noarch/nbclassic-0.3.5-pyhd3eb1b0_0.conda
139+
https://repo.anaconda.com/pkgs/main/noarch/jupyterlab-3.3.2-pyhd3eb1b0_0.conda
140+
https://repo.anaconda.com/pkgs/main/linux-64/matplotlib-3.5.1-py310h06a4308_1.conda
141+
https://repo.anaconda.com/pkgs/main/linux-64/matplotlib-base-3.5.1-py310ha18d171_1.conda
142+
https://repo.anaconda.com/pkgs/main/linux-64/mkl_fft-1.3.1-py310hd6ae3a3_0.conda
143+
https://repo.anaconda.com/pkgs/main/linux-64/mkl_random-1.2.2-py310h00e6091_0.conda
144+
https://repo.anaconda.com/pkgs/main/linux-64/numpy-1.22.3-py310hfa59a62_0.conda

source_code/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.ipynb_checkpoints/

source_code/README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# # Source code
2+
3+
Code samples for in the presentation, or provided as extra material, illustrating
4+
certain subtle points.
5+
6+
## What is it?
7+
8+
1. `coins.ipynb`: change a sum of money into coinage, comparing a brute force
9+
approach to recursion, memoization and dynamic programming.
10+
1. `condorcet_voting.ipynb`: implementation of Condorcet voting.
11+
1. `counterintuiive.ipynb`: some example of counter-intuitive performance results.
12+
1. `dHondt_method.ipynb`: assigning seats in gremia according to the number of votes.
13+
1. `dice.ipynb`: modelling throwing two dice and visualizng the results.
14+
1. `dynamic_programming.ipynb`: some illustrations of using memoization and
15+
dynamic programming to efficiently solve mathematical problems.
16+
1. generations.ipynb`: searching for the most recent common ancestor and the
17+
identical ancestor generation.
18+
1. `hundred_prisoners.ipynb`: implementation of the solution to the "hundred
19+
prisoners` puzzle.
20+
1. `islands.ipynb`: identify "islands" in a 2D sea.
21+
1. `josephus.ipynb`: solving the Josephus problem; various implementations are
22+
compared for performance.
23+
1. `kaprekar.ipynb`: compute the Kaprekar number.
24+
1. `neighborhoods.ipynb` and '`game.png`: computing the hairiness of neighborhoods.
25+
1. `one_liners.ipynb`: implementatin of a variety of problems as Python one-liners;
26+
this is for sport, not production.
27+
1. `survival.ipynb`: study populatoin sizes in terms of procreation rates.
28+
1. `structural_pattern_matching.ipynb`: example of structural pattern matching
29+
(requires Python 3.10+).
30+
1. `welford_algorithm.ipynb`: implementation of WellFord's algorithm to compute an
31+
estimate for the standard deviation of a data stream.
32+
1. `word_chains.ipynb`: create word chains out of a list of words so that the first
33+
letter of a word is the same as the last letter of the previous. Search for the
34+
longest chain.
35+
1. `knights_tour.ipynb`: example of using backtracking to solve the knight's tour
36+
problem.
37+
1. `flatten.ipynb`: `itertools.chain` may not flatten a data structure as you might
38+
expect or want.

0 commit comments

Comments
 (0)