1. Learn
  2. /
  3. Courses
  4. /
  5. Working with Dates and Times in Python

Connected

Exercise

Counting events per calendar month

Hurricanes can make landfall in Florida throughout the year. As we've already discussed, some months are more hurricane-prone than others.

Using florida_hurricane_dates, let's see how hurricanes in Florida were distributed across months throughout the year.

We've created a dictionary called hurricanes_each_month to hold your counts and set the initial counts to zero. You will loop over the list of hurricanes, incrementing the correct month in hurricanes_each_month as you go, and then print the result.

Instructions

100 XP
  • Within the for loop:
  • Assign month to be the month of that hurricane.
  • Increment hurricanes_each_month for the relevant month by 1.