1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Debora [2.8K]
2 years ago
7

Write a program that creates a dictionary containing the U.S. states as keys and their abbreviations as values. The program shou

ld then randomly quiz the user by displaying the abbreviation and asking the user to enter that state's name. The program should keep a count of the number of correct and incorrect responses, as well as which abbreviation the user missed. You should include the following: Mainline logic and functions Error handling Dictionaries
Computers and Technology
1 answer:
AleksandrR [38]2 years ago
6 0

Answer:

Explanation:

The following program is written in Python. It creates a loop that keeps creating a random number to randomly choose a State abbreviation from the dictionary. Then it asks the user what the state is. If the user gets the answer correct it prints out "Correct" and adds 1 point to the correct variables. Otherwise it prints "Incorrect" and adds 1 point to the incorrect variable. Finally, printing out the final amount of correct and incorrect responses. The program was tested and the output can be seen below.

import random

states = {"AL":"Alabama","AK":"Alaska","AZ":"Arizona","AR":"Arkansas","CA":"California","CO":"Colorado","CT":"Connecticut","DE":"Delaware","FL":"Florida","GA":"Georgia","HI":"Hawaii","ID":"Idaho","IL":"Illinois","IN":"Indiana","IA":"Iowa","KS":"Kansas","KY":"Kentucky","LA":"Louisiana","ME":"Maine","MD":"Maryland","MA":"Massachusetts","MI":"Michigan","MN":"Minnesota","MS":"Mississippi","MO":"Missouri","MT":"Montana","NE":"Nebraska","NV":"Nevada","NH":"New Hampshire","NJ":"New Jersey","NM":"New Mexico","NY":"New York","NC":"North Carolina","ND":"North Dakota","OH":"Ohio","OK":"Oklahoma","OR":"Oregon","PA":"Pennsylvania","RI":"Rhode Island","SC":"South Carolina","SD":"South Dakota","TN":"Tennessee","TX":"Texas","UT":"Utah","VT":"Vermont","VA":"Virginia","WA":"Washington","WV":"West Virginia","WI":"Wisconsin","WY":"Wyoming"}

keys_list = list(states)

correct = 0

incorrect = 0

while True:

   randNum = random.randint(0, 49)

   abbr = keys_list[randNum]

   answer = input("Enter The State name of " + abbr + ": ")

   if answer.lower() == states[abbr].lower():

       print("Correct")

       correct += 1

   else:

       print("Incorrect")

       incorrect += 1

   again = input("Play again? y/n ")

   if again.lower() == 'n':

       break

print("Correct: " + str(correct))

print("Incorrect: " + str(incorrect))

You might be interested in
Variable costs are __________.<br><br> A. decreasing<br> B. increasing<br> C. static
lubasha [3.4K]
The answer is A. Decreasing
5 0
3 years ago
categorize each job role as an administrative job or management job auditor director legal secretary payroll clerk etc ​
abruzzese [7]

Explanation:

look after the office jobs

3 0
3 years ago
You want to connect to a user desktop to review windows 10 configuration settings when the user is not present. which technology
MakcuM [25]

Remote desktop is a technology that allows users to connect to a specific computer from a remote location as if they were sitting in front of it.

<h3>What is the desktop remote system?</h3>

A remote desktop is a program or an operating system feature that permits a user to connect to a computer in another location, see that computer's desktop and interact with it as if it were local.

<h3>What is Remote Desktop example?</h3>

A basic example of a Remote Desktop is securing your home laptop to your office PC so you can access files, run applications, print documents, etc. on that PC without going into the office.

However, the host machine does not have to be a PC. It is often a waitperson or virtual server environment in many business use cases.

To learn more about  remote desktop, refer

brainly.com/question/4455143

#SPJ4

3 0
2 years ago
I NEED SOME MAJOR HELP W/ THIS!!! PLSSS. WHOEVER HELPS GETS 80 POINTS!!! I NEED IT DONE SOON! TYY &lt;3;)
Oksanka [162]

Answer:

I probably won't awnser them all but I'll try my best

Explanation:

Hacking is a breach of privacy online usually caused by some kind of malware injected into your device there's multiple types of this program or files malware which simply damages and harms your device. A Trojan horse is a program which tricks you by selling you a fake product which has code in it which has code which gives the hacker remote access to your device this program is usually free and masked like a crack or patch of a certain program. U got the second an third question with this one so u can just divide it into pieces. Piracy is Hacking but this time the hacker is stealing ur information through the malware. Invasion of privacy can have multiple forms online and offline. Online intrusion is when a service gives out information you entrust to it while off line Intrusion is stalking trespassing blackmail etc.

4 0
3 years ago
You told your sister about creating bullet points with Word 2013. She calls you and says that she created a list of six bullet p
lapo4ka [179]

Answer:

Tell her to hold the Shift key as she hits Enter.

8 0
3 years ago
Other questions:
  • Which audio editing effect uses the option ""Get Profile"" to execute its function?
    6·1 answer
  • What command displays a computer s network settings?
    5·1 answer
  • Signs of mastery include?
    10·1 answer
  • What X coordinate does the center of a game begin at?
    9·1 answer
  • How do you freeze the total cell so that it doesn't change when copied?
    6·1 answer
  • How to get bing with any node unblocker
    10·2 answers
  • I'm getting pretty desperate plz help me, I'll give brainiest, and ill make a free question worth 100 points this is for coding
    10·1 answer
  • How many cubic millimeters are present in 0.0923 m3?​
    14·1 answer
  • rue or false: The first web browser was introduced to the public in the 1970s and started the explosive growth of the Internet i
    15·1 answer
  • The designers of a database typically begin by developing a​ __________ to construct a logical representation of the database be
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!