The resulting PDF version is as follows:
Due to system restrictions, the ipynb file cannot be uploaded. When viewing the answer, delete the suffix .txt to view the code file in ipynb format. The code is as follows:
Supplementary note:
In the title, there is a prompt in the code box before Task 1: \”### EXTRA CODE FOR TASK 1 goes here\”. The code should be submitted to the code box before Task 1. In Task 1, I added clarification about the results of the code as requested.
new ipynb file as follows:
