This excercice was made on a jupyter notebook, I know that the first part of my code could be made made much easier with the command "groupby" but unfortunately I couldn´t solved how to match it with the rest of my code, that is why my code is too large.
Also, most of the code was made by me, but I take the excercise that was inside of the zip folder as a template.