Question: use Syder to execute the Python code and answer the questions Note: This assignment uses an external text file, capitals.txt Design a program that displays

use Syder to execute the Python code and answer the questions

Note: This assignment uses an external text file, capitals.txt

Design a program that displays a state code and asks a user to enter the capital of the state. After all of the state capitals have been displayed, the same should show the user the number of correct capital names entered and the state codes and capitals that the user got wrong. The program should open the file, capitals.txt. and load the file contents into a Python dictionary. Note: the data is formatted as state_code capital state_code capital

Use the dictionary method, popitem(), to remove a random state_code: capital pair. Display the state_code to the user and ask the user to enter the name of the capital. If the user's entry is correct, add one to the correct capital counter. If the answer is not correct, display "Incorrect" to the user and save the state_code and capital in a 2-dimensional list formatted as [[state_code, capital], [state_code, capital], ...] When the dictionary is empty, display the number of correct answers to the user. Then display the incorrect state_codes and capitals in a tabular format: State Capital CT Hartford NE Lincoln

names in txt file

AL Montgomery AK Juneau AZ Phoenix AR Little Rock CA Sacramento CO Denver CT Hartford DE Dover FL Tallahassee GA Atlanta HI Honolulu ID Boise IL Springfield IN Indianapolis IA Des Moines KS Topeka KY Frankfort LA Baton Rouge ME Augusta MD Annapolis MA Boston MI Lansing MN St. Paul MS Jackson MO Jefferson City MT Helena NE Lincoln NV Carson City NH Concord NJ Trenton NM Santa Fe NY Albany NC Raleigh ND Bismarck OH Columbus OK Oklahoma City OR Salem PA Harrisburg RI Providence SC Columbia SD Pierre TN Nashville TX Austin UT Salt Lake City VT Montpelier VA Richmond WA Olympia WV Charleston WI Madison WY Cheyenne

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!