#!/usr/bin/env python # Make sure to install requests before running: # > pip install requests import requests # This declares a variable of type String url = "https://data.seattle.gov/resource/pu5n-trf4.json" # Goes to the given URL to get the data response = requests.get(url) if response.status_code == 200: # if it was a success (200), parse the data as JSON data = response.json() print(data) # print out the data incident_types = {} # Make an empty map for incident in data: # foreach loop over the array of objects subgroup = incident['initial_type_subgroup'] # get the thing with key "initial_type_subgroup" if subgroup not in incident_types: # this is how you check contains incident_types[subgroup] = 0 incident_types[subgroup] += 1 # you can use += here unlike Java print(incident_types) # print out the map