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
n200080 [17]
2 years ago
13

Prompt the user to input five pairs of numbers: A player's jersey number (0 - 99) and the player's rating (1 - 9). Store the jer

sey numbers and the ratings in a dictionary. Output the dictionary's elements with the jersey numbers in ascending order (i.e., output the roster from smallest to largest jersey number). Hint: Dictionary keys can be stored in a sorted list. (3 pts)
Computers and Technology
1 answer:
Reika [66]2 years ago
5 0

Answer:

  1. jersey_dict = {}
  2. for i in range(5):
  3.    j_num = int(input("Input Jersey's number (0-99): "))
  4.    rating = int(input("Input rating (1 - 9): "))  
  5.    jersey_dict[j_num] = rating  
  6. sorted_key = []
  7. for i in jersey_dict.keys():
  8.    sorted_key.append(i)
  9. sorted_key.sort()
  10. for i in sorted_key:
  11.    print(str(i) + ":" + str(jersey_dict[i]))

Explanation:

Firstly, define an empty dictionary (Line 1).

Next, use a for loop to prompt user to input five Jersey's number and rating and keep the input to the dictionary (Line 3-6). Next, create a list to hold the dictionary keys (Line 8-10). Use build in method, sort to arrange the keys in the list in ascending order (Line 12 ). At last, print the dictionary element by looping over the value in the sorted_key list (Line 14-15).

You might be interested in
Henry is designing a document for his architecture project. In which order should Henry preform the different tasks that are req
nadezda [96]

It is

Select an appropriate layout

Decide which current format...

Import or compose...

Proofread...

Check the print preview..

4 0
3 years ago
a) What are the 'interrupts' in a computer system? Describe the approaches to deal with multiple interrupts in a system.b) Analy
Fynjy0 [20]

Answer:

a)

An interrupt is a signal sent to the processor which indicates an event that needs immediate attention.

  • Interrupts are usually sent to CPU by external or I/O devices.
  • This notifies the processor to a high-priority process that requires the current process to be disrupted.
  • Interrupts requests the processor to stop its ongoing operations and run appropriate part of OS.
  • If the request is acknowledged, the processor may respond by halting its current operation, saving its state. Processor then executes a function called an interrupt handler to handle the event that needs attention.
  • This interrupt is temporary, and processor continues normal activities after the interrupt operator stops, unless the interrupt shows a fatal error.
  • The CPU must inform the device that its interrupt request is acknowledged so that it stops sending interrupt signals.
  • Interrupts are usually used for multitasking purposes in real time computers.
  • There are two basic types of interrupts: hardware and software interrupts.
  • A hardware interrupt requests are generated by hardware devices, to indicate that it needs attention from the operating system.
  • Software interrupts are either requested by programs when they want  some service from the operating system or these interrupts are generated by processor itself on executing particular instructions or when certain requirements are met.

Approaches to deal with multiple interrupts:

There are two approaches to handle multiple interrupts.

  1. One approach is to disable interrupts while an interrupt is being processed. A disabled interrupt means that processor will ignore that interrupt request. If during this phase an interrupt happens, it usually remains pending and will be reviewed by the processor after the interrupts has been enabled by the processor. So, when a program is being executed and an interrupt happens, interrupts are disabled immediately.Upon completion of the interrupt handler procedure, interrupts are allowed before the user program resumes, and the processor checks if other interrupts have occurred. This is a simple technique which deals with the interrupts sequentially. But it does not deal with priority requirements.
  2. Second approach is to define interrupt priorities to enable a higher priority interrupt to cause disruption of a lower-priority interrupt handler. For example take a system with 3 I/O devices: printer, disk and communication line with priorities 3,5, and 7. Lets say when a program starts a printer interrupt happens. The execution continues at printer ISR. At some time interval communication interrupt happens whilst this ISR is still executing. Due to the higher priority of the communication line than the printer, the interrupt is accepted and printer routine is interrupted. Its state is placed on stack and now execution resumes at communication line ISR. Now at some time interval the disk interrupt happens while communication routine is still executing. As the priority of disk interrupt is lower so this is held and communication isr execute completely. Suppose communication ISR finishes, then the previous state is resumed which is printer's ISR execution. But as the disk has higher priority than printer, the processor continues execution in disk ISR. After the completion of disk routine execution, the printer ISR is resumed. After the printer ISR execution is completed the control goes back to the user program.

b) Benefits of using multiple bus architecture compared to single bus architecture are as follows:

  • In a multiple bus architecture each pathway is tailored to deal with a specific type of information. This enhances performance as compared to single bus architecture which is used by simple computers to transfer data onto single bus. Performance enhancement is an important reason for having multiple buses for a computer system.
  • Multiple bus architecture allows multiple devices to work at the same time. This reduces waiting time and enhances the speed of the computer as compared to single bus architecture in which all the components share a common bus. Sharing a common bus causes bus contention which results in slowing down the computer and waiting time increases.
  • Having several different buses available allows to have multiple choices for connecting devices to computer system.
  • Bus designs changes, with the introduction of new types and forms from time to time. Multiple bus architecture with several buses can support equipment from different time periods and helps to retain obsolete equipment such as printers and old hard drives, and also add new ones. This is the compatibility benefit of using multiple bus architecture.
  • CPU places heavy load on bus which carries data from memory and peripheral traffic. So nowadays computers take on multi core model with multiple buses required. So multiple bus architecture is a good option for such systems as it carries more amounts of data through the processor with minimum wait time.

3 0
2 years ago
Technician A says that there are two types of battery cells, primary (non-rechargable) and secondary. Technician B says there ar
Scrat [10]

Technician A is correct.

Electrochemical batteries can be classified into two main categories; Primary Cells and Secondary Cells.

A primary battery or cell cannot easily be recharged after use and is usually recommended to be discarded following discharge. Most primary cells are termed dry due to their capability of utilizing electrolytes contained within absorbent material.

A secondary cell, on the other hand, can be recharged electrically to their original pre-discharge condition.

4 0
2 years ago
Read 2 more answers
This isn't an academic question, but it's a question about something I am consistently seeing on Brainly, so please don't delete
s344n2d4d5 [400]
Yes it does. Hope that answers
3 0
2 years ago
Read 2 more answers
if you want to have certain icons available regardless of what tab you are using you should add them to the
jarptica [38.1K]
The hotbar is what i think it is called but it is basically the bar of stuff at the bottom of the screen on windows computers.
4 0
3 years ago
Other questions:
  • What is the use of pecil icon
    11·2 answers
  • How fast can the winds blow in a tornado?
    8·2 answers
  • When CPU failed what will happen?
    10·1 answer
  • A computer reads a sequence from top to bottom and left to right? True or False
    6·1 answer
  • Wireless data networks are particularly susceptible to known ciphertext attacks.
    10·1 answer
  • In what form do the hexadecimal numbers need to be converted for a computer’s digital circuit to process them?
    10·1 answer
  • Virus program do not replicate themselves true or false one word answer only​
    15·2 answers
  • Writing down your main ideas, subpoints, and supporting material, then using geometric shapes and arrows to indicate logical rel
    10·1 answer
  • If html is used to specify the content of the webpage, then what do you use css for?.
    12·1 answer
  • HELP PLEASE
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!