Breaking down each line of the For Loop in Question 8 of Pandas Viz

Hi There,

On question 8 on the Pandas Vizualizations and Grid Charts question, they offer a for loop solution I have never seen before - I am having a hard time understanding the for loop logic - is it possible to break it down step by step?

More specifically, I don’t understand what the traffic[i:i+27] convention is doing?

days = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday']
traffic_per_day = {}
for i, day in zip(range(0, 135, 27), days):
    each_day_traffic = traffic[i:i+27]
    traffic_per_day[day] = each_day_traffic

On question

1 Like

There is an existing answer to this question which might help - Why does the range look like this? - #2 by dash.debasmita

1 Like