Code for Lecture 11 (PY)