Question: Problem: Write a program that will display information for a state typed in by the user. When the user types in the name of a
Problem:
Write a program that will display information for a state typed in by the user. When the user types in the name of a state the program should display the states capital, number of congressional districts and the order the state joined the union (1st 2nd 3rd etc).
Program
- Your program will initialize lists to store information about the states. You should have one list for the names of the states, one list for the names of the capitals, one list for the number of districts per state and one list for the order number the state joined the union.
- Next ask the user to enter a name of a state.
- Find the index of that name.
- Use that index to report back to the user the name of the capital, the number of congressional districts and the order the state joined the union.
(here is the code to import)
state =[ 'Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', 'Colorado', 'Connecticut', 'Delaware', 'Florida', 'Georgia', 'Hawaii', 'Idaho', 'Illinois', 'Indiana', 'Iowa', 'Kansas', 'Kentucky', 'Louisiana', 'Maine', 'Maryland', 'Massachusetts', 'Michigan', 'Minnesota', 'Mississippi', 'Missouri', 'Montana', 'Nebraska', 'Nevada', 'New Hampshire', 'New Jersey', 'New Mexico', 'New York', 'North Carolina', 'North Dakota', 'Ohio', 'Oklahoma', 'Oregon', 'Pennsylvania', 'Rhode Island', 'South Carolina', 'South Dakota', 'Tennessee', 'Texas', 'Utah', 'Vermont', 'Virginia', 'Washington', 'West Virginia', 'Wisconsin', 'Wyoming' ]
capital =[ 'Montgomery', 'Juneau', 'Phoenix', 'Little Rock', 'Sacramento', 'Denver', 'Hartford', 'Dover', 'Tallahassee', 'Atlanta', 'Honolulu', 'Boise', 'Springfield', 'Indianapolis', 'Des Moines', 'Topeka', 'Frankfort', 'Baton Rouge', 'Augusta', 'Annapolis', 'Boston', 'Lansing', 'St. Paul', 'Jackson', 'Jefferson City', 'Helena', 'Lincoln', 'Carson City', 'Concord', 'Trenton', 'Santa Fe', 'Albany', 'Raleigh', 'Bismarck', 'Columbus', 'Oklahoma City', 'Salem', 'Harrisburg', 'Providence', 'Columbia', 'Pierre', 'Nashville', 'Austin', 'Salt Lake City', 'Montpelier', 'Richmond', 'Olympia', 'Charleston', 'Madison', 'Cheyenne' ]
districts =[ '7', '1', '8', '4', '53', '7', '5', '1', '25', '13', '2', '2', '19', '9', '5', '4', '6', '7', '2', '8', '10', '15', '8', '4', '9', '1', '3', '3', '2', '13', '3', '29', '13', '1', '18', '5', '5', '19', '2', '6', '1', '9', '32', '3', '1', '11', '9', '3', '8', '1', ]
joined =[ '22', '49', '48', '25', '31', '38', '5', '1', '27', '4', '50', '43', '21', '19', '29', '34', '15', '18', '23', '7', '6', '26', '32', '20', '24', '41', '37', '36', '9', '3', '47', '11', '12', '39', '17', '46', '33', '2', '13', '8', '40', '16', '28', '45', '14', '10', '42', '35', '30', '44' ]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
