Question: PYTHON 3.6 Put the data into a states_capital dictionary; after creating the dictionary, start a while loop that asks for a 2-character state code like

PYTHON 3.6

Put the data into a states_capital dictionary;

after creating the dictionary, start a while loop that asks for a 2-character state code like OR for oregon or 'QUIT' to stop.

Read us_states_capital.csv file,

strip off the newline character

split the data on commas , into a row_list

Create two variables, state and capital

with values assigned from the row_list.

Use the state and capital variables to form a dictionary.

Use state as the key and capital as the value.

Use a while loop to request a state 2 character code.

State to look up, or "QUIT" when done: AK

AK capital is Juneau

State to look up, or "QUIT" when done: ca4

CA capital is Sacramento

State to look up, or "QUIT" when done: quit

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!