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
olga nikolaevna [1]
2 years ago
10

Your task is to implement a function replace_once(t, d), that takes a text t and a replacement dictionary d, and returns the res

ult of replacing words according to the dictionary: if a word appears as a key, replace it with the dictionary value, and if a word does not appear in the dictionary, leave it alone.
Given a list of words, you can concatenate them together with spaces in between as follows:
word_list = "I love eating bananas".split()
print("Word list:", word_list)
back_together = " ".join(word_list)
print("Back together:", back_together)
# You can also join them in other ways, btw. Just DON'T do it for this homework.
print("You can also put commas:", ", ".join(word_list))
Computers and Technology
1 answer:
djverab [1.8K]2 years ago
4 0

Answer:

Explanation:

The following code is written in Python and does exactly as requested. It is a function named replace_one(t, d) that takes the two parameters one text/word and one dictionary. If the word is found as a key in the dictionary it places the value in a variable called new_word and returns it to the user, if it is not found then the function returns nothing.

def replace_once(t, d):

   if t in d:

       new_word = d.get(t)

       return new_word

   return

You might be interested in
1.6<br> What do you call the two parts of the lift that goes down a mine?
Likurg_2 [28]

Answer:

Sheave wheel and hoist cable

Explanation:

The sheave wheel is a pulley wheel that sits above the mine shaft. The hoist cable passes over the sheave wheel and then down the shaft of the mine. The sheave wheel reduces the sliding friction of the mine cable. The head frame is the structure that supports the sheave wheel.

7 0
3 years ago
Carl is a music teacher. He builds custom computer systems for his students to use when they are learning and creating music. Ca
shutvik [7]

Answer:

um ahh <em> </em><em>badl</em><em>y</em><em> </em>

Explanation:

i really don't know the answer

4 0
2 years ago
A user has multiple web pages open and is using email. Which layer of the Transmission Control Protocol/Internet Protocol (TCP/I
Fudgin [204]

Answer:

This is the second question like this I've seen. They aren't the greatest.

Explanation:

The question is not good. The answer would be option a, Transport even though it doesn't make a whole lot of sense when you really go into detail.

It could also be option d, Application but I think they're going for the first.

6 0
2 years ago
How many bits would be used to count the students in class today?There are 10 students
Vikentia [17]

Answer:

4 bits

Explanation:

With 4 bits you can count to 15, because 2⁴=16. The maximum number you can express is always one less, i.e., 16-1=15.

In general, with n bits you can count to 2ⁿ-1.

7 0
3 years ago
Read 2 more answers
Match each type of option on the left with a corresponding function on the right.
Marta_Voda [28]

Answer:

yes. the above is correct

Explanation: q posted

7 0
2 years ago
Other questions:
  • Declare a character variable letterStart. Write a statement to read a letter from the user into letterStart, followed by stateme
    10·1 answer
  • What type of cable would you use to connect two hosts together in a back-to-back configuration using twisted pair cable?
    15·1 answer
  • The Spanning Tree Protocol operates at the Network layer of the OSI model.
    13·1 answer
  • Jim, your organizations IAM, has been contacted by the Program Manager to assist in implementing the DIACAP. Jim is not required
    11·1 answer
  • How do you change your username
    6·2 answers
  • Q: Why can't I log in to Brainly
    13·1 answer
  • Ryan would like to copy a list of contacts from a colleague into his personal address book. The list of contacts is
    9·1 answer
  • A SOCCER club uses ICT to
    10·1 answer
  • I’ll give brainliest if answers are correct
    11·1 answer
  • Given an array of integers a, your task is to calculate the digits that occur the most number of times in the array. Return the
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!