Guided Project: Exploring Hacker News Posts; Step 5

Screen Link:

My Code:

import datetime as dt

result_list = []
for row in ask_posts:
    created_at = row[6]
    num_comments = int(row[4])
    each_list = [created_at, num_comments]

counts_by_hour = {}
comments_by_hour = {}
for row in result_list:
    activity_date = row[0]
    each_hour = dt.datetime.strptime(activity_date,"%m/%d%/%Y %H:%M").strftime("%H")
    if each_hour not in counts_by_hour:
        counts_by_hour[each_hour] = 1
        comments_by_hour[each_hour] = row[1]
        counts_by_hour[each_hour] += 1
        comments_by_hour[each_hour] += row[1]

What I expected to happen:
To get two dictionaries recording the amount of ask posts created per hour, along with the total amount of comments.

What actually happened:

ValueError                                Traceback (most recent call last)
<ipython-input-29-f8bf45874851> in <module>
      4 for row in result_list:
      5     activity_date = row[0]
----> 6     each_hour = dt.datetime.strptime(activity_date,"%m/%d%/%Y %H:%M").strftime("%H")

~\anaconda3\lib\ in _strptime_datetime(cls, data_string, format)
    575     """Return a class cls instance based on the input string and the
    576     format string."""
--> 577     tt, fraction, gmtoff_fraction = _strptime(data_string, format)
    578     tzname, gmtoff = tt[-2:]
    579     args = tt[:6] + (fraction,)

~\anaconda3\lib\ in _strptime(data_string, format)
    349                 del err
    350                 raise ValueError("'%s' is a bad directive in format '%s'" %
--> 351                                     (bad_directive, format)) from None
    352             # IndexError only occurs when the format string is "%"
    353             except IndexError:

ValueError: '/' is a bad directive in format '%m/%d%/%Y %H:%M'

I just don’t get it, I can’t figure out what might be wrong with my format. Can anybody enlighten me please?

It looks like you have an extra % after %d. Once you remove that I think you’ll be good to go.

■■■, I’ve read it several times and never noticed this foolish mistake!
Thank you so much @april.g!