Doubt of a part of code

Could you explain to me what the for 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

Excuse me if a beginner question

I would like you to break the code down, line-by-line to figure out what it is doing first -

  • What does the range() function do?
    • Have you checked the documentation for it?
  • Based on the above, what would the output of range(0, 135, 27) be?
  • What does the zip() function do?
    • Have you checked the documentation for it?
  • Based on the above, what would the output of zip(range(0, 135, 27), days) be?
  • Based on the above output, what do you think the for loop iterates over?
  • Inside the for loop, print out i and day and see if the values match with what you figured out above.

Go through the process above. Think through each line of code.

If you get stuck or get confused, then feel free to ask questions. We can move forward from there to discuss what happens inside the for loop after you figure out the above.

Please note: Make sure that you include the link to the Mission Step you are referring to in your posts. Having the links helps add appropriate context which makes it easy to help out.