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
Process redesign and reengineering in 1500 words
timama [110]

Answer:

Process re-design is the process in which re-work is done to achieve the improvement in the output. The major aim is to set the goals for achieving the main objective.

The various essential steps in the process of re-design are:

  • Data capturing process are used to identify the process and making the necessary changes.
  • Identify every step of the process to ensure that process is in organized way along with the workflow.

Re-engineering is the process of re-design the system with focuses to improve the efficiency and quality. It basically analysis the whole business re-engineering process. The main step is to identify the need for the changes.

 

7 0
3 years ago
Explain why the fundamental software engineering principles of process, dependability, requirements management, and reuse are re
Georgia [21]

These principles are not explicit to one kind of program and are increasingly broad "best practice" rules that assist designers with composing code that is easier to maintain.

<u>Explanation:</u>

A set of programming guidelines that are executed to play out a particular undertaking according to the prerequisites of the client is known as programming. Every product has some essential standards to follow. In light of all product frameworks have basic quality traits, including accessibility, modifiability, execution, security and wellbeing, testability and ease of use, the key programming thoughts give basic arrangements or strategies to help those characteristics.

It is generally less expensive, over the long haul, to utilize programming designing strategies and methods for programming frameworks instead of simply compose the projects as though it was an individual programming venture.

8 0
3 years ago
By arranging users into security groups, it is possible to set permissions at a group-level, avoiding the unwieldy alternative o
Anni [7]

Answer:

The department by department is arranging users into security groups to set permission at a group-level.

Explanation:

Team by team is just formed group method but the team been set will work on based on the project. Once the project is getting over then the team group assigned permission has to be disabled or deleted.

 

Department by department is just good methods where each department will have a list of users and easy to assign the group.

user-by-user. is just assigning the rights of each individual user. But if the user has multiple departments login it will be good advice.

organization-by-organization. It is just assigning rights to complete users list in the organization.  

6 0
3 years ago
What is the process to correct a single spelling mistake that has been indicated by the spelling checker in PowerPoint Online?
marshall27 [118]
I’m not to sure what this is asking, if by selecting word- it means the word is already left-click selected, so it would be option 3. If not, then it would be option 2 I believe
6 0
3 years ago
Why are hardline Ethernet connections always faster than WiFi?
Bumek [7]
Because Ethernet uses cables, it tends to work slightly faster than a wireless connection. Wireless connections are a bit slower, but provide the convenience of using it within range. Today, WiFi hotspots can easily be found in many places. Thus, the choice lies between speed and convenience.
Wi-Fi vs. Ethernet: Which Connection to Use?
by Allen Jame
3 0
3 years ago
Other questions:
  • A network of Bennetton retail sales agents select the Bennetton designs that they feel will appeal to Bennetton retail customers
    10·2 answers
  • Which of the following terms means that the system changes based on
    14·1 answer
  • 15) the following statement describes government depository librearies , except:
    12·1 answer
  • What color is the smartart tolls tab?
    5·1 answer
  • When using the Common Internet File System (CIFS), which security model does not require a password to be set for the file share
    7·1 answer
  • Http://www.alegrium.com/sgi/2/eibder
    5·1 answer
  • Pls help I will give points
    7·1 answer
  • The full meaning of ENIAC,ABACUS,EDVAC,EDSAC<br>and explain ​
    7·1 answer
  • Joseph wants to take out the color of the background wall from an image what can Joseph do to achieve this​
    5·2 answers
  • Which of the following statements is true of San serif fonts?
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!