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
A strong example of using keywords would be a. Using “good” to remember the word “hideous” c. Both of these b. Using “hide” to r
posledela

The answer to the question you have asked is <u><em>"B" . </em></u> Because if you really think about it, there is no possible way that "Good" can be a keyword of "Hideous".

6 0
3 years ago
A system is being developed to help pet owners locate lost pets. Which of the following best describes a system that uses crowds
Slav-nsk [51]

Crowdsourcing  is used by mobile application that allows users to report the location of a pet that appears to be lost.

<h3>What is a mobile application?</h3>

A mobile application is known to be a kind of computer app or program that has been made to handle or run itself on a mobile device e.g. phone,  etc.

Conclusively, the option that best describes a system that uses crowdsourcing is the mobile application that allows users to report the location of a pet that appears to be lost and upload a photo that is made available to other users of the application and thus everyone can help to look for it.

Learn more about mobile application  from

brainly.com/question/9477543

#SPJ1

6 0
2 years ago
A state university locks in costs for a student once a student starts attending the university. The total cost is $24,500. A stu
zlopas [31]
10,700+5000+1600=17,300
24,500-17,300=7,200
7,200/10=
$720.00 will need to be saved every month.
6 0
3 years ago
Read 2 more answers
What filter would only include data from a campaign titled back to school in campaign reports?.
Mkey [24]

Answer:

Custom Include filter with field "Campaign Name" and pattern "back to school"

Explanation:

6 0
2 years ago
When you start a browser, it automatically loads and displays a page from a web site. This is known as your ____. Class: compute
EastWind [94]

Answer:

Index page.

Explanation:

The index page is the URL or local file that automatically loads when a web browser starts and when the browser's 'home' button is pressed. The term is also used to refer to the front page, web server directory index, or main web page of a website of a group, company, organization, or individual.

6 0
3 years ago
Other questions:
  • The ____ provides access to the Internet may also be internal.
    14·2 answers
  • To accomplish a certain task when you would rsther be doing something else is an example of
    9·1 answer
  • Hide Time Remaining A
    11·1 answer
  • Who invented the Bluetooth device​
    12·1 answer
  • Assume the user responds with a 3 for the first number and a 4 for the second number.
    13·1 answer
  • How do you open an application on the macOS?
    11·2 answers
  • Please NEED HELP ASAP WILL MARK BRAINLIEST ONLY #8
    8·1 answer
  • I need help <br> with a question<br> what can i write for ex when he mad
    13·2 answers
  • Write a program that uses the Purchase class in 5.13. Set the prices to the following: Oranges: 10 for $2.99 Eggs: 12 for $1.69
    11·1 answer
  • Write a java code to print Multiplication Table Till 20
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!