answer.
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
daser333 [38]
2 years ago
8

The function below takes two arguments, a dictionary called dog_dictionary and a list of dog names (strings) adopted_dog_names.

The dog dictionary uses dogs' names as the keys for the dictionary. Complete the function to remove all the adopted dogs from the dog_dictionary. Return the dictionary at the end of the function.
Computers and Technology
1 answer:
laiz [17]2 years ago
4 0

Answer:

The solution code is written in Python.

  1. def removeAdoptedDog(dog_dictionary, adopted_dog_names):
  2.    for x in adopted_dog_names:
  3.        del dog_dictionary[x]
  4.    
  5.    return dog_dictionary  
  6. dog_dictionary = {
  7.    "Charlie": "Male",
  8.    "Max" : "Male",
  9.    "Bella" : "Female",
  10.    "Ruby": "Female",
  11.    "Toby": "Male",
  12.    "Coco": "Female",
  13.    "Teddy": "Male"
  14. }
  15. print(dog_dictionary)
  16. adopted_dog_names = {"Ruby", "Teddy"}
  17. print(removeAdoptedDog(dog_dictionary, adopted_dog_names))

Explanation:

Firstly, let's create a function <em>removeAdoptedDog() </em>takes two arguments, <em>dog_dictionary </em>& <em>adopted_dog_names</em> (Line 1)

Within the function, we can use a for-loop to traverse through the <em>adopted_dog_names</em> list and use the individual dog name as the key to remove the adopted dog from <em>dog_dictionary </em>(Line 3). To remove a key from a dictionary, we can use the keyword del.

Next return the updated dog_dictionary (Line 5).

Let's test our function by simply putting some sample records on the <em>dog_dictionary</em> (Line 7 -15)  and two dog names to the <em>adopted_dog_names list</em> (Line 19).

Call the function <em>removeAdoptedDog() </em>by<em> </em>passing the <em>dog_dictionary and adopted_dog_names </em>as arguments. The display result will show the key represented by the<em> adopted_dog_names</em> have been removed from the <em>dog_dictionary </em>(Line 21).

You might be interested in
Carrie is looking at the Form Properties Sheet. Which tab will control how the data is displayed and the data source it is bound
Lemur [1.5K]
The Answer is: Data


Hope this help
8 0
2 years ago
What is the data transmission time, assuming no errors or overhead, to send a 2 GByte file over a link with a 2 Gbps line rate?
schepotkina [342]

Answer:

The data transmission time will be 8 seconds (8.0s)

Explanation:

Using the formular:

T =A/S

T=Time = ?

Amount of Data = A = 2GByte

Speed = S = 2Gbps

The units of A and S are different

A is expressed in Bytes(B)

S is expressed in bits(b)

But :

1 Byte(B) = 8 bits(b)

T = A/S = 2GB/2Gb

since 1 Byte = 8 bits

T = 2 × G ×( B =8bits) / 2 × G × b

T = 2 × G × 8b / 2 × G × b

T = 2 × G × 8 × b / 2 × G × b

The common terms(2,G,b) cancel out

T = 8 seconds

4 0
2 years ago
Your assignment is to write an assembly language program which read a string and print it in uppercase. This program asks the us
-BARSIC- [3]

Answer:

Check the explanation

Explanation:

.data

prompt: .asciiz "Please enter your string :"

result_str: .asciiz "\nYour captalized string :"

error_prompt: .asciiz "\nInvalid Entry !"

buffer: .space 20

.text

.globl __start

__start:

ASKING_STR:

la $a0,prompt

li $v0,4

syscall

li $v0,8 #take in input

la $a0, buffer #load byte space into address

li $a1, 20 # allot the byte space for string

move $t0,$a0 #save string to t0

syscall

li $v0, 4

li $t0, 0

loop:

lb $t1, buffer($t0)

beq $t1, 0, exit

slti $t2,$t1,91

bne $t2,$0,UPPER_CHECK

slti $t2,$t1,123

bne $t2,$0,LOWER_TO_UPPER

UPPER_CHECK:

slti $t2,$t1,65

bne $t2,$0,INVALID_ENTRY

slti $t2,$t1,90

bne $t2,$0,NEXT

j INVALID_ENTRY

LOWER_TO_UPPER:

sub $t1, $t1, 32

sb $t1, buffer($t0)

NEXT:

addi $t0, $t0, 1

j loop

INVALID_ENTRY:

li $v0, 4

la $a0, error_prompt

syscall

j ASKING_STR

exit:

li $v0, 4

la $a0, result_str

syscall

li $v0, 4

la $a0, buffer

syscall

li $v0, 10

syscall

4 0
2 years ago
During a traceroute, which action does a router perform to the value in the Time To Live (TTL) field?
Sladkaya [172]

Answer:

<em>During a traceroute, the router decreases the Time To Live values of the packet sent from the traceroute by one during routing, discards the packets whose Time To Live values have reached zero, returning the ICMP error message ICMP time exceeded.</em>

Explanation:

Traceroute performs a route tracing function in a network. It is a network diagnostic commands that shows the path followed, and measures the transit delays of packets across an Internet Protocol (IP) network, from the source to the destination, and also reports the IP address of all the routers it pinged along its path. During this process, the traceroute sends packets with Time To Live values that increases steadily from packet to packet; the process is started with Time To Live value of one. <em>At the routers, the Time To Live values of the packets is gradually decreased by one during routing, and the packets whose Time To Live values have reached zero are discarded, returning the ICMP error message ICMP Time Exceeded</em>

7 0
2 years ago
De'Von is graduating from college and wants to create a professional development plan in order to prepare for his future. What i
galina1969 [7]

1. De'von must first ask himself What is the job I want?

2. A person preparing for his future career must first become aware of what does he actually wants in his life?

3. What kind of job he is well suited for?

4. Where his interest lies?

5. Then he will have to discover what kind of skills he is having in which areas he needs to improve?

6. What are the set of skills he requires for his dream job?

6 0
2 years ago
Other questions:
  • What was one important academic skill the blogger learned?
    9·1 answer
  • In step 4 of the CSMA/CA protocol, a station that successfully transmits a frame begins the CSMA/CA protocol for a second frame
    9·1 answer
  • 1. Create a view named customer_addresses that shows the shipping and billing addresses for each customer.
    15·1 answer
  • Sites like Zillow get input about house prices from a database and provide nice summaries for readers. Write a program with two
    12·1 answer
  • Which of the following is a true statement about cloud computing?
    6·1 answer
  • In a system where Round Robin is used for CPU scheduling, the following is TRUE when a process cannot finish its computation dur
    13·1 answer
  • Seneca has just applied conditional formatting and realizes that she has made a mistake. Which action should she take to fix the
    12·2 answers
  • While rendering the homepage of a website, it takes a lot of time due to the thread being blocked in processing JS/CSS. What are
    15·1 answer
  • In the range D5:D9 on all five worksheets, Gilberto wants to project next year's sales for each accessory, rounded up to zero de
    6·1 answer
  • You are responsible for a rail convoy of goods consisting of several boxcars. You start the train and after a few minutes you re
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!