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
erastova [34]
3 years ago
6

Write a program that requests a state abbreviation as input and displays the justices appointed from that state. The justices sh

ould be ordered by their years served. The output should also display the last name of the appointing president and the length of time served. (Note: For current justices, use 2015 - yrAppointed as their time of service. Otherwise, use yrLeft - yrAppointed.) Also, the program should inform the user if no justices have been appointed from the requested state.
Computers and Technology
1 answer:
ololo11 [35]3 years ago
8 0

Answer:

justice_dict = {}

with open("justices.txt", "r") as fh:

for line in fh:

data = line.split(",")

if int(data[-1]) == 0:

continue

 

yearServed = int(data[-1]) - int(data[-2])

state = data[-3]

president = data[2].split()[-1]

justice = data[0] + " " + data[1]

if state in justice_dict:

current_data = [justice, president, yearServed]

i = 0

inserted = False

for data in justice_dict[state]:

i += 1

if yearServed > data[2]:

inserted= True

justice_dict[state].insert(i, current_data)

break

if not inserted:

justice_dict[state].append(current_data)

 

else:

justice_dict[state] = [[justice, president, yearServed]]

state = input("Enter a state abbreviation: ")

if state in justice_dict:

print("")

print("Justice\t\tAppointing Pres\t\tYrs Served")

for data in justice_dict[state]:

print(data[0] + "\t" + data[1]+ "\t\t\t" + str(data[2]))

else:

print("No justices have been appointed from the requested state")

Explanation:

You might be interested in
1.what is a computer?
Amanda [17]
1. an electronic device for storing and processing data, typically in binary form, according to instructions given to it in a variable program.
2. a peripheral device, as a keyboard or stylus, used to enter data into a computer for processing.
3. Output is defined as the act of producing something, the amount of something that is produced or the process in which something is delivered. An example of output is the electricity produced by a power plant. An example of output is producing 1,000 cases of a product.

4. A system unit is the part of a computer that houses the primary devices that perform operations and produce results for complex calculations. It includes the motherboard, CPU, RAM and other components, as well as the case in which these devices are housed.
8 0
3 years ago
Computer operates nearly 100% accurately but why is the phrase'garbage in garbage out'(GIGO) associated with their use?Describe
k0ka [10]

Answer:

A program gives inaccurate results due to inaccurate data provided because a computer will always attempt to process data given to it. Said another way, the output quality of a system usually can't be any better than than the quality of inputs.

Explanation:

Techopedia Explains Garbage In, Garbage Out (GIGO)

<h3>Mark me a brainlist</h3>
8 0
3 years ago
As text is typed in the _____ text box, a drop-down list displays options for completing the action, displaying information on t
pickupchik [31]

Answer:

Excel Help

Explanation:

Press F1 key to open the excel help window

Or you can also click the excel help button to launch the help window.

Type for whatever you are seeking help for and you will notice suggestions as you type something. These suggestions include online and offline results. If there are too many results then try searching offline it will narrow down the results.

After typing the text and hitting enter, the excel help returns several related topics on the searched query. You can browse through these topics and get help from excel.

5 0
3 years ago
The length of time that a slide appears in a power point presentation before automatically advancing to the next slide can be se
vivado [14]
The length of time that a slide appears in a power point presentation before automatically advancing to the next slide can be set in the <span> the Transitions tab, then from Timing section, and enable After option and then enter the time interval.</span>
8 0
3 years ago
Harrison works in a manufacturing unit and oversees the logistics, including the daily shipping of a large number of packages. W
Nookie1986 [14]

E. Transaction processing system

Explanation:

He will need a transaction processing system to know the amount of logistics available daily and how many to ship and how many to order.

Transaction processing system will make him keep track of what transactions take place during the various days to help him give a good report.

8 0
3 years ago
Read 2 more answers
Other questions:
  • To illustrate a point in a Word document with a simple chart, what commands should you select?
    8·2 answers
  • ____ is an act, directed at Web sites catering to children, that requires site owners to post comprehensive privacy policies and
    5·1 answer
  • Define foreign key. What is this concept used for?
    6·1 answer
  • Display the total number of parking tickets.
    5·1 answer
  • When I press F3, F4, and any of my apps on my mac why wouldn't it do anything? Do you have a way to solve this problem? When I p
    10·2 answers
  • Help Me Please, Ill mark whoever has the best answer with brainliest.
    14·1 answer
  • Weaknesses about ICT Technician
    9·1 answer
  • A person who breaks into a computer, network, or online site is called
    14·2 answers
  • Imagine that your parents were starting a small business, and they wanted to upgrade their data storage. Would you recommend a f
    11·1 answer
  • Write a C++ program to grade the answers to a true-false quiz given to students in a course. The quiz consists of 5 true-false q
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!