def get_regions():
  """
  Get a dictionary of state names mapped to their respective region numeric values.

  New England -> 0
  Mid Atlantic -> 1
  Midwest East -> 2
  Midwest West -> 3
  Southeast -> 4
  Southwest -> 5
  Mountain West -> 6
  Pacific -> 7
  Alaska -> 8
  Hawaii -> 9

  Returns:
    dictionary of state names mapped to region numbers
  """
  new_england = ['Connecticut', 'Maine', 'Massachusetts', 'New Hampshire', 'Rhode Island', 'Vermont']
  mid_atlantic = ['New Jersey', 'New York', 'Pennsylvania', 'Delaware', 'Maryland', 'District of Columbia']
  midwest_east = ['Illinois', 'Indiana', 'Michigan', 'Ohio', 'Wisconsin']
  midwest_west = ['Iowa', 'Kansas', 'Minnesota', 'Missouri', 'Nebraska', 'North Dakota', 'South Dakota']
  southeast = ['Florida', 'Georgia', 'South Carolina', 'Virginia', 'Alabama', 'Kentucky', 'Mississippi', 'Tennessee', 'Arkansas', 'Louisiana', 'West Virginia', 'North Carolina']
  southwest = ['Texas', 'Oklahoma', 'New Mexico', 'Arizona']
  mtn_west = ['Montana', 'Idaho', 'Wyoming', 'Colorado', 'Nevada', 'Utah']
  pacific = ['Washington', 'Oregon', 'California']
  alaska = ['Alaska']
  hawaii = ['Hawaii']

  regions = []
  regions.append(new_england)
  regions.append(mid_atlantic)
  regions.append(midwest_east)
  regions.append(midwest_west)
  regions.append(southeast)
  regions.append(southwest)
  regions.append(mtn_west)
  regions.append(pacific)
  regions.append(alaska)
  regions.append(hawaii)

  # Map each state to its region number
  output = {}
  for i in range(len(regions)):
    states = regions[i]
    for j in range(len(states)):
      output[states[j]] = i
  return output
def get_regions ( ) : new_england = [ 'Connecticut' , 'Maine' , 'Massachusetts' , 'New Hampshire' , 'Rhode Island' , 'Vermont' ] mid_atlantic = [ 'New Jersey' , 'New York' , 'Pennsylvania' , 'Delaware' , 'Maryland' , 'District of Columbia' ] midwest_east = [ 'Illinois' , 'Indiana' , 'Michigan' , 'Ohio' , 'Wisconsin' ] midwest_west = [ 'Iowa' , 'Kansas' , 'Minnesota' , 'Missouri' , 'Nebraska' , 'North Dakota' , 'South Dakota' ] southeast = [ 'Florida' , 'Georgia' , 'South Carolina' , 'Virginia' , 'Alabama' , 'Kentucky' , 'Mississippi' , 'Tennessee' , 'Arkansas' , 'Louisiana' , 'West Virginia' , 'North Carolina' ] southwest = [ 'Texas' , 'Oklahoma' , 'New Mexico' , 'Arizona' ] mtn_west = [ 'Montana' , 'Idaho' , 'Wyoming' , 'Colorado' , 'Nevada' , 'Utah' ] pacific = [ 'Washington' , 'Oregon' , 'California' ] alaska = [ 'Alaska' ] hawaii = [ 'Hawaii' ] regions = [ ] regions . append ( new_england ) regions . append ( mid_atlantic ) regions . append ( midwest_east ) regions . append ( midwest_west ) regions . append ( southeast ) regions . append ( southwest ) regions . append ( mtn_west ) regions . append ( pacific ) regions . append ( alaska ) regions . append ( hawaii ) output = { } for i in range ( len ( regions ) ) : states = regions [ i ] for j in range ( len ( states ) ) : output [ states [ j ] ] = i return output
Get a dictionary of state names mapped to their respective region numeric values.

  New England -> 0
  Mid Atlantic -> 1
  Midwest East -> 2
  Midwest West -> 3
  Southeast -> 4
  Southwest -> 5
  Mountain West -> 6
  Pacific -> 7
  Alaska -> 8
  Hawaii -> 9

  Returns:
    dictionary of state names mapped to region numbers