Chapter 4 q 1, python solution
Chapter 4 q2, python solution