Last active
November 4, 2020 06:40
-
-
Save sowbug/1bd70689719d8b8c9e919c4dbc9c9bb8 to your computer and use it in GitHub Desktop.
Make it easier for Python programmers to create FiveThirtyEight simulations on November 3, 2020
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env python3 | |
TOSSUP = [ | |
'GA', # Georgia, 16 | |
'NC', # North Carolina, 15 | |
] | |
DEM_NARROW = [ | |
'AZ', # Arizona, 11 | |
'ME', # Maine Popular Vote, 2 | |
'M1', # Maine 1st, 1 | |
'M2', # Maine 2nd, 1 | |
'MI', # Michigan, 16 | |
'NV', # Nevada, 6 | |
'PA', # Pennsylvania, 20 | |
'WI', # Wisconsin, 10 | |
] | |
REP_NARROW = [ | |
'AK', # Alaska, 3 | |
] | |
DEM_CALLED = [ | |
'CA', # California | |
'CO', # Colorado | |
'CT', # Connecticut | |
'DC', # District of Columbia | |
'DE', # Delaware | |
'HI', # Hawaii | |
'IL', # Illinois | |
'MA', # Massachusetts | |
'MD', # Maryland | |
'MN', # Minnesota | |
'N2', # Nebraska 2nd, 1 | |
'NH', # New Hampshire | |
'NJ', # New Jersey | |
'NM', # New Mexico | |
'NY', # New York | |
'OR', # Oregon | |
'RI', # Rhode Island | |
'VA', # Virginia | |
'VT', # Vermont | |
'WA', # Washington | |
] | |
REP_CALLED = [ | |
'AL', # Alabama | |
'AR', # Arkansas | |
'FL', # Florida | |
'IA', # Iowa | |
'ID', # Idaho | |
'IN', # Indiana | |
'KS', # Kansas | |
'KY', # Kentucky | |
'LA', # Louisiana | |
'MO', # Missouri | |
'MS', # Mississippi | |
'MT', # Montana | |
'ND', # North Dakota | |
'NE', # Nebraska Popular Vote, 2 | |
'N1', # Nebraska 1st, 1 | |
'N3', # Nebraska 3rd, 1 | |
'OH', # Ohio | |
'OK', # Oklahoma | |
'SC', # South Carolina | |
'SD', # South Dakota | |
'TN', # Tennessee | |
'TX', # Texas | |
'UT', # Utah | |
'WV', # West Virginia | |
'WY', # Wyoming | |
] | |
URL = "https://projects.fivethirtyeight.com/trump-biden-election-map/#" | |
states = [] | |
for state in DEM_CALLED: | |
states.append(state + ":0") | |
URL += ",".join(states) | |
URL += "," | |
states = [] | |
for state in REP_CALLED: | |
states.append(state + ":1") | |
URL += ",".join(states) | |
print(URL) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment