Hey all,
Struggling to understand this for loop. Specifically, I’m not sure what:
zip(range(0, 135, 27), days):
each_day_traffic = traffic[i:i+27]
is really doing?
My Code:
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
I feel comfortable answering the question for this lesson, as it doesn’t really require me to understand anything other than that traffic_per_day is a dictionary. However, should I understand at this point what the above is doing?
I think I understand how zip works, but unsure about the range values, and
[i:i+27] ?
Thanks