Home > Net >  API Data is not being added to my dictionary correctly
API Data is not being added to my dictionary correctly

Time:12-29

API: enter image description here

Thus, 16 16 13 15 = 60

The issue is when you initialise the stats object,

change from

self.stats = [n for i in range(32)]

to

self.stats = [[
            {"Turnover Differential": []},  # 0
            {"RedZone Efficiency": []},  # 1
            {"Third Down Attempts": []},  # 2
            {"Third Down Conversions": []},  # 3
            {"Fourth Down Attempts": []},  # 4
            {"Fourth Down Conversions": []},  # 5
            {"Kickoff Yards": []},  # 6
            {"Kickoff Attempts": []},  # 7
            {"Kick Return Yards": []},  # 8
            {"Kick Return Attempts": []},  # 9
            {"Punt Yards": []},  # 10
            {"Punt Attempts": []},  # 11
        ] for i in range(32)]

The previous code gives you 32 references to the same object n (updating one will show the changes in all the items), whereas the new code gives you 32 distinct (independent) objects.

  • Related