""" report the number of crime incident reported by the Houston Police Department to FBI's National Incident-Based Reporting System (NIBRS) """ def get_date(line): """ Get the date from a line in NIBRS file, a csv file. The date is the value of column #2. """ return line.split(',')[1] filename = 'NIBRSPublicView2025.csv' count = {} # dict storing the count of incidence in a date. E.g., '1/1/2025' with open(filename, 'r') as f: # Discard the first line, the heading. f.readline() # process every line to update the dict count. for i, line in enumerate(f): date = get_date(line) if date in count: # not the first occurence of date. count[date] += 1 else: # first occurence of date. count[date] = 1 print("Houston crime incidences reported to FBI NIBRS in 2025") for date, value in count.items(): print(f"{date}: {value}")