Screen Link: Learn data science with Python and R projects
At this point in the Guided Project, we are shown how to find the amount of helicopter prison break attempts per year. We are shown how to create a for loop within a for loop and the mechanics are throwing me off.
Instruction 1 - for each row in data
for ya in attempts_per_year: # Instruction 2 - nothing to do here
# Instruction 3 - assign the year value in ya to y
if row[0] == y:
ya[1] += 1
Instruction 4 - print the results
What I expected to happen:
I am just confused as to what is going on in general. From what I understand we are seeing when the year attempted in the Data loop matches the year attempted in the attempts per year loop and then incrementing the attempts whenever they match up.
There is a lot going on and is a bit overwhelming at the moment, but what do I put in #instruction #3 and how does this fit into our overall goal of incrementing years_attempted?
Thank you in advance.