This is to address the situation when you already have these three lists (States, Abb, Capitals) and want make suitable datastructure (as in buran's last example) for lookup:
data = dict() for (state, short, capital) in zip(States, Abb, Capitals): data.update(dict.fromkeys((state, short), capital))This will give dictionary where keys are state names and their abbreviations, value in both cases is state capital (on personal note - as non-american I learned a lot about US states capitals - I knew less than half of them) which enables fast lookup:
Output:{'Alabama': 'Montgomery', 'AL': 'Montgomery', 'Alaska': 'Juneau', 'AS': 'Juneau', 'Arizona': 'Phoenix', 'AZ': 'Phoenix', 'Arkansas': 'Little Rock', 'AK': 'Little Rock', 'California': 'Sacramento', 'CA': 'Sacramento', 'Colorado': 'Denver', 'CO': 'Denver', 'Connecticut': 'Hartford', 'CT': 'Hartford', 'Delaware': 'Dover', 'DL': 'Dover', 'Florida': 'Tallahassee', 'FL': 'Tallahassee', 'Georgia': 'Atlanta', 'GA': 'Atlanta', 'Hawaii': 'Honolulu', 'HA': 'Honolulu', 'Idaho': 'Boise', 'IA': 'Boise', 'Illinois': 'Springfield', 'IL': 'Springfield', 'Indiana': 'Indianapolis', 'IN': 'Indianapolis', 'Iowa': 'Des Moines', 'IO': 'Des Moines', 'Kansas': ', Topeka', 'KS': ', Topeka', 'Kentucky': 'Frankfort', 'KY': 'Frankfort', 'Louisiana': 'Baton Rouge', 'LO': 'Baton Rouge', 'Maine': 'Augusta', 'MA': 'Augusta', 'Maryland': 'Annapolis', 'MD': 'Annapolis', 'Massachusetts': 'Boston', 'MC': 'Boston', 'Michigan': 'Lansing', 'MI': 'Lansing', 'Minnesota': 'Saint Paul', 'MN': 'Saint Paul', 'Mississippi': 'Jackson', 'MS': 'Jackson', 'Missouri': 'Jefferson City', 'MO': 'Jefferson City', 'Montana': 'Helena', 'MT': 'Helena', 'Nebraska': 'Lincoln', 'NB': 'Lincoln', 'Nevada': 'Carson City', 'NV': 'Carson City', 'New Hampshire': 'Concord', 'NH': 'Concord', 'New Jersey': 'Trenton', 'NJ': 'Trenton', 'New Mexico': 'Santa Fe', 'NM': 'Santa Fe', 'New York': 'Albany', 'NY': 'Albany', 'North Carolina': 'Raleigh', 'NC': 'Raleigh', 'North Dakota': 'Bismarck', 'ND': 'Bismarck', 'Ohio': 'Columbus', 'OH': 'Columbus', 'Oklahoma': 'Oklahoma City', 'OK': 'Oklahoma City', 'Oregon': 'Salem', 'OR': 'Salem', 'Pennsylvania': 'Harrisburg', 'PA': 'Harrisburg', 'Rhode Island': 'Providence', 'RI': 'Providence', 'South Carolina': 'Columbia', 'SC': 'Columbia', 'South Dakota': 'Pierre', 'SD': 'Pierre', 'Tennessee': 'Nashville', 'TN': 'Nashville', 'Texas': 'Austin', 'TX': 'Austin', 'Utah': 'Salt Lake City', 'UT': 'Salt Lake City', 'Vermont': 'Montpelier', 'VT': 'Montpelier', 'Virginia': 'Richmond', 'VA': 'Richmond', 'Washington': 'Olympia', 'WA': 'Olympia', 'West Virginia': 'Charleston', 'WV': 'Charleston', 'Wisconsin': 'Madison', 'WN': 'Madison', 'Wyoming': 'Cheyenne', 'WY': 'Cheyenne'}
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.