Solution(jupyter notebook)

Click Exercise5Solution.ipynb link to view the file.