Guided Project: Prison Break 18/06/2022

In my attempt, I encounter a few type error saying “data” is the wrong type. I deleted the entire code block and do that part again and somehow it works. I am wondering what went wrong but I forgot to copy down the error message.

In the “Attempts per Year II” session, I was getting [[1971, 2], [1972, 1], [1973, 2], …]] something like this the first time I print it. Basically ya[1] is off by 1. I press shift-enter one more time then I got [[1971, 3], [1972, 2], [1973, 3], …]]. I was confused again so I delete the entire block and somehow it get me the correct answer.

https://nbviewer.org/github/stephen9397/Guided-Project-Prison-Break/blob/fed4a5c02c5ba6a85fbc2de70fd8fdf478e104fc/Guided%20project%20prison%20break.ipynb

Basics.ipynb (79.6 KB)

Hi @stephen.chan.sc

congratulations on finishing the first guided project. I believe the error could have occured by running a certain code block multiple times.

To give you an example, if there is a code to delete row number 10, and if you run the code block multiple times, it will first delete the original row number 10. In the next run original row 11 would be at the position of 10 and it will be deleted, if you run it again. This might not be ideal and can cause errors. This is a very general and simplified example. Something similar could have happened in your case.

If such things are happening, you can find "Restart and rerun kernal’ on your jupyter notebook and see if the error gets rectified. When you restart and rerun, the code cells runs from the beginning and usually rectifies errors caused by running a code cell multiple times.

I had a quick glance through your project and everything looks good. I can see that you’ve followed the instructions very carefully. Good job.

You can refer this guide to add more explanations to your project and make it more readable.

Looking forward to seeing more projects from you. Good luck. I hope this helps.