Create an old sample dictionary {0:10, 1:20} as follows to store numbers. Write a Python script to ask how many runs from user input to add items to the old dictionary. Use a loop to append these key/value pairs to the dictionary. Print out the resulting dictionary for each run (NOT just the last run). Please find the number patterns to append key/value pairs. You cannot add the numbers manually.

Answers

Answer 1

Answer:

Here is the Python code:

runs=int(input("how many runs do you want to add items to dictionary? "))  #store input number of runs

d = dict()  #creates a dictionary

d = {0:10,1:20}  #old dictionary

count=0  #counts number of runs

for x in range(2,runs+2):  #loop to append key/value pairs to dictionary

   d[x]=(x*10)+10  #multiples and adds 10 to the each value

   count+=1  #adds 1 to the count at each iteration

   print("After the #",count, "run the new dictionary is: ",d) #prints the new dictionary

Explanation:

I will explain the program with an example:

The old dictionary is :

d = {0:10,1:20}  

runs = 3

count = 0

At first iteration:

x = 2

d[x]=(x*10)+10

This becomes:

d[2]=(2*10)+10

d[2]= 20 + 10

d[2]= 30

count+=1

count = 1

   print("After the #",count, "run the new dictionary is: ",d)

This statement displays the first iteration result :

After the # 1 run the new dictionary is:  {0: 10, 1: 20, 2: 30}  

At  second iteration:                                                              

x = 3

d[3]=(3*10)+10

This becomes:

d[3]=(3*10)+10

d[3]= 30 + 10

d[3]= 40

count+=1

count = 2

   print("After the #",count, "run the new dictionary is: ",d)

This statement displays the first iteration result :

After the # 2 run the new dictionary is:  {0: 10, 1: 20, 2: 30, 3: 40}      

At  third iteration:                                                              

x = 4

d[4]=(4*10)+10

This becomes:

d[4]=(4*10)+10

d[4]= 40 + 10

d[4]= 40

count+=1

count = 3

   print("After the #",count, "run the new dictionary is: ",d)

This statement displays the first iteration result :

After the # 3 run the new dictionary is:  {0: 10, 1: 20, 2: 30, 3: 40, 4: 50}    

Now the loop breaks as x = 5 necause n+2 = 3+2 = 5 limit is reached

The screenshot of program along with its output is attached.

Create An Old Sample Dictionary {0:10, 1:20} As Follows To Store Numbers. Write A Python Script To Ask

Related Questions

what is your role in helping a person who is cyber bullied?​

Answers

to try and talk to the person being cyber bullied and get them away from even more harm

Please help fast I’m on a timer

Answers

Answer: The second bubble

Explanation: I did this one also beileve me i got the best results

Answer:I’d say your right

Explanation: I think your right, the colored in dot, the first one

How do you code in C++. Please keep this basic as possible and I will report is I get a bad answer like my last time doing this question

Answers

Answer:

What do you need?

Explanation:

I'm a C++ semi-starter and I can get you started with some basic things, just tell me what help do you need (Programming enviroment, enviroment problems, errors ,..)

This program outputs a downwards facing arrow composed of a rectangle and a right triangle. The arrow dimensions are defined by user specified arrow base height, arrow base width, and arrow head width.
(1) Modify the given program to use a loop to output an arrow base of height arrow_base_height.
(2) Modify the given program to use a loop to output an arrow base of width arrow_base_width.
(3) Modify the given program to use a loop to output an arrow head of width arrow_head_width.
(4) Modify the given program to only accept an arrow head width that is larger than the arrow base width.
Use a loop to continue prompting the user for an arrow head width until the value is larger than the arrow base width.
while arrow_head_width <= arrow_base_width: arrow_head_width = int(input('Enter arrow head width:\n')) Example output for arrow_base_height = 5, arrow_base_width = 2, and arrow_head_width = 4: Enter arrow base height: 5 Enter arrow base width: 2 Enter arrow head width: 4 tot tr

Answers

Answer:

Here is the Python program:

arrow_base_height = int(input('Enter arrow base height: \n'))  #prompts user to enter the arrow base height

arrow_base_width = int(input('Enter arrow base width: \n')) #prompts user to enter the arrow base width

arrow_head_width = int(input('Enter arrow head width: \n'))  #prompts user to enter the arrow head width

while (arrow_head_width <= arrow_base_width):  #ensures that the arrow head width is greater than base width

    arrow_head_width = int(input('Enter arrow head width: \n'))  #keeps prompting user to enter arrow head width until the value is larger than the arrow base width.

for i in range(arrow_base_height):  #to print arrow shaft

   for j in range(arrow_base_width):  #iterates through arrow base width

       print ('*', end='')  #prints asterisks

   print ()  #prints new line

for i in range(arrow_head_width):  #iterates through arrow head width arrow head

   for j in range(arrow_head_width-i):  #iterates through arrow head width-i

        print ('*', end='')  #prints asterisks

   print()  #prints new line

       

Explanation:    

The program works as follows:

Suppose user enters 5 as arrow base height, 2 as arrow base width and 4 as arrow head widths so,

arrow_base_height = 5

arrow_base_width = 2

arrow_head_width = 4

Since the arrow_head_width is not less than arrow_base_width so the while loop at the start does not execute. Program control moves to the statement:

for i in range(arrow_base_height):

for j in range(arrow_base_width):

Both of these loop are used to print the shaft line and after execution of these loops the output becomes:

**

**

**

**

**

Note that the outer loop is executed 5 times as arrow_base_height=5 and the inner loop iterates two times for each iteration of outer loop because arrow_base_width is 2 and the print ('*', end='') statement keeps printing the asterisks whereas print() prints a new line after printing 2 asterisks at each line.

Next the program moves to the following loops:

for i in range(arrow_head_width):

   for j in range(arrow_head_width-i):

Both of these loop are used to print the arrow head and after execution of these loops the output becomes:

****

***

**

*

Note that the outer loop is executed 4 times as arrow_head_width=4 and the inner loop iterates 4 times in start and decrements one time at each iteration and the print ('*', end='') statement keeps printing the asterisks whereas print() prints a new line after printing 2 asterisks at each line.

So the entire output of this program is:

**

**

**

**

**

****

***

**

*

The screenshot of the program along with its output is attached.

Match each keyboard command with its result.
Control + End
jumps to the beginning of a document
Page Up
e
moves backward in a document
Control + Home
jumps to the end of a document
moves forward in a document
Page Down

Answers

Answer:

The answer to this question is given below in the explanation section

Explanation:

The following are the correct match according to the keyboard command with its result.

Control + End  - jumps to the end of a document Control + Home  - jumps to the beginning of a document Page Up  - moves backward in a documentPage Down - moves forward in a document

what is mouse and how many types of mouse are there​

Answers

Answer:

a mouse is the object that controls the cursor on your computer/laptop, there's one standard type of mouse, but there are thousands of makes and models.

Explanation:

Answer: A mouse is a rodent, and there are over 1,000 mouses, probably including me, electric mouse.

Explanation: how do I explain this?

What are the top five vulnerabilities of your operating system? Discuss any three steps you take to secure your operating system. Which tools do you use to safeguard your operating system and why? In your opinion, which OS integrity check is the most important? Why? Hellppoopp marking brainlisttttt

Answers

Answer:

SQL Injections (SQLi)

Risky Reuse of Passwords Across Multiple Platforms

Out of Date Patches

Custom Crafted URL Queries and Misconfigured Server Settings

In-House Designed and Developed Software

Explanation:

1 Keep up with system and software security updates.

2 Enable a firewall.

3 Install antivirus and anti spyware software.

Suppose Client X initiates a FTP session with Server W and requests data transferring. At about the same time, Client Y also initiates a FTP session with Server and requests data transferring W. Provide possible source and destination port numbers for:______.
a) The segments sent from X to W.
b) The segments sent from Y to W.
c) The segments sent from W to X.
d) The segments sent from W to Y.
e) Is it possible that the source port number in the segments from X to W is the same as that from Y to W?
f) How about if they are the same host? Hints: You may use any valid port numbers; make sure to use the correct patterns to design the port numbers to support communication

Answers

Answer:

Folllows are the solution to the given points:

Explanation:

In this question, the server uses special port 21 and  20 for the command and data transfer. A customer uses a random short-term N > 1023 and N+1 ports Listen and the Ports may be randomly distributed and the following samples are given for:  

In point (a):

X: 1030 Client, W server: 21 (service)  

W: 20 server (data) ,Client X:1031

In point (b):

Server W: 21 (command) Client Y: 1035  

Client Y: 1036, (data) Server W: 20  

In point (c):

Client X: 1030, Server W: 21.  

Client X: 1031, (data) Server W: 20  

In point (d):

Client X: 1035, Server W: 21.  

Client X: 1036 ,(data): Server W: 20.  

In point (e):

Yes, it's an opportunity. It can be the same as a certain likelihood.  

In point (f):

The port of the server is the norm. If W and Y are on the same host, the client's port numbers can vary.  

why is there a need of properly interpreting teacher's/manufacturer's specifications before operating any food processing equipment?​

Answers

Answer:

Explanation:

This is a significant need because the teacher's/manufacturer's specifications are created so that the individual operating the equipment knows how to properly operate it. Failure to read and properly interpret these specifications can lead to the damaging of the equipment, damaging the food, contamination of the food, and even injury/death to the operator. That is why it is crucial that the information is read and interpreted correctly as well as implemented as instructed.

There's a need to properly interpret teacher's/manufacturer's specifications before operating any food processing equipment due to D. All of these.

From the information given, it should be noted that there's a need to properly interpret teacher's/manufacturer's specifications before operating any food processing equipment in order to be familiar with the parts and functions.

Also, it's important in order to avoid accidents due to faulty operation of equipment and to be able to determine the correct operation of the equipment. Therefore, the correct operation is all of the above.

Read related link on:

https://brainly.com/question/14407771

1. What is an advantage of the PCIe bus over the PCI bus?
2. Which type of devices typically use Mini PCI cards?
3. Which bus type is commonly used by graphics cards?
4. What type of slot can a PCIe x1 expansion card be placed in?

Answers

Answer:

Explanation:

1. PCI Express (PCIe) is a next generation I/O bus architecture. Rather than a shared bus, each PCIe slot links to a switch which prioritizes and routes data through a point-to-point dedicated connection and provides a serial full-duplex method of transmission.

2. Mini-ITX or Laptops

3.PCMCIA Personal Computer Memory Card International Association

4. PCIe x1 slot

What is NAND gate?With example

Answers

Answer:

In digital electronics, a NAND gate (NOT-AND) is a logic gate which produces an output which is false only if all its inputs are true; thus its output is complement to that of an AND gate. A LOW (0) output results only if all the inputs to the gate are HIGH (1); if any input is LOW (0), a HIGH (1) output results.

Answer:

NAND

Explanation:

In digital electronics, a NAND gate (NOT-AND) is a logic gate which produces an output which is false only if all its inputs are true; thus its output is complement to that of an AND gate. A LOW (0) output results only if all the inputs to the gate are HIGH (1); if any input is LOW (0), a HIGH (1) output results.

Which of the following is a true statement
15 points dont worry about the 3rd one

Answers

Answer:

The true statement in #2 is the third one (C)

Other Questions
what is hazard meaning fast mark correct as brailiest i need help can you help Check all the answers that apply. Energy is the ability toQuestion 8 options:Change directionDo workChange temperatureChange speed What are tiny sacs at the end of the bronchioles filled with air called? What type of note gets 4 beats of sound? Someone help me pls I will give brainlist What is measurement without a unit Which two conversion factors would be used to convert the quantity of 4500 seconds into hours. Which answer best explains why the contents of a warm can of carbonated drink might rush out of the can faster than the contents of a cold can when the cans are first opened? A The warm drink is under higher pressure than the cold drink, B The temperature of the gas in the warm drink increases when the can is opened. The volume of the drink decreases slightly when the temperature increases D The warm drink has more gas dissolved in it than the cold drink, Simplify: +84 + 9 x 61 - (116)3 The perimeter of a rectangle is 60m.the length is 2m less than 3 times the width.what is the area of the rectangle? How can I do 3.6 code practice What volume would a 200-gram sample of gold have if its density is known to be 19.3 g/mL? How to say my name is in Spanish Utility companies usually charge their customers based on the number of kilowatt-hours their customers consume in a period. Suppose the function A(p)=0.096p+19.50 represents the monthly charge, A, in dollars for a customer with Electric Company A consuming p kilowatt-hours of power. The function B(p)=0.104p+17.75 represents the monthly charge, B, in dollars for a customer with Electric Company B consuming p kilowatt-hours of power. Analyze the functions by interpreting the slope and y-intercept for each function in terms of the context for this situation. Then assess how the slope and y-intercept of Electric Company A compare with the slope and y-intercept of Electric Company B in this situation. No matter what type, all cells have the following cell structures in common: 1 pointcytoplasm, cell membranes, and ribosomes.TrueFalse 15 points !!! Please answer at least one thanks :) I will also mark brainliest Please hurry!! Avery must hand out 270 fliers. So far.she has handed out 90% of them. Howmany fliers has Avory handed out? why is there a need of properly interpreting teacher's/manufacturer's specifications before operating any food processing equipment? Will give brainliest