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
Ede4ka [16]
2 years ago
11

Write a program that replaces words in a sentence. The input begins with word replacement pairs (original and replacement). The

next line of input is the sentence where any word on the original list is replaced.
Ex: If the input is:

automobile car children kids manufacturer maker The automobile manufacturer recommends car seats for children if the automobile doesn't already have one.

then the output is:
The car maker recommends car seats for kids if the car doesn't already have one.
You can assume the original words are unique.
Computers and Technology
1 answer:
marin [14]2 years ago
4 0

Answer:

Following are the program in the Python Programming Language

#set variable to input sentence to replace words

sen = input()

#split that sentence

sen = sen.split()

#set variable to input whole sentence

get = input()

#set the for loop to replace words

for i in range(0, len(sen), 2):

 #check condition when words of sen is in get

 if sen[i] in get:

   #then, replace words

   get = get.replace(sen[i], sen[i+1])

#print the whole string after replacing

print('\n',get)

Explanation:

<u>Following are the description of the program</u>.

  • Set a variable 'sen' that get a sentence for replacing the word.
  • Split that sentence by split() method and again store that sentence in the following variable.
  • Set a variable 'get' that gets the whole sentence from the user.
  • Set the for loop for replacing words then, set the if conditional statement that checks the condition that the variable 'sen' in the variable 'get' then replace the words.
  • Finally, print the whole sentence after the replacement.
You might be interested in
A laptop gets replaced if there's a hardware issue. Which stage of the hardware lifecycle does this scenario belong to?
Ilya [14]

Answer: Maintenance. This is the stage where software is updated and hardware issues are fixed if and when they occur. Retirement. In this final stage, hardware becomes unusable or no longer needed and it needs to be properly removed from the fleet

Explanation:

3 0
2 years ago
. Question 2 Fill in the blank: R Markdown notebooks can be converted into HTML, PDF, and Word documents, slide presentations, a
Levart [38]

R markdown notebook describes a notebook format in R programming which supports R programmers to run codes while also writing documents or explanation alongside. Hence, the missing option is Dashboard.

  • R markdown may be compared to jupyter notebooks which also supports writing in markdown language.

  • The R markdown notebooks can be created using the R studio, which allows the conversion notebooks of these notebooks into several different formats including the creation of dashboards.

Hence, R markdown notebooks can be converted to <em>HTML</em><em> </em><em> </em><em> </em><em>PDF</em><em>,</em><em> </em><em>word</em><em> </em><em>document</em><em>,</em><em> </em><em>slide</em><em> </em><em>presentation</em><em> </em><em>and</em><em> </em>dashboards.

Learn more :brainly.com/question/25575402

3 0
1 year ago
Compare the memory organization schemes of contiguous memory allocation and paging with respect to the following issues: a. Exte
Free_Kalibri [48]

Answer:

The comparison is based on memory organization schemes of contiguous memory allocation and paging with respect to External fragmentation, Internal fragmentation and Ability to share code across processes.

Explanation:

Memory organization schemes of contiguous memory allocation:

Contiguous memory allocation schemes suffers from external fragmentation. The reason is that address space is distributed contiguously and the holes and gaps keep growing when the old processes die and new processes are introduced. The variable size partition suffers from external fragmentation however the fixed size partitions do not suffer from external fragmentation. Contiguous memory allocation with variable size partitions does not encounter an internal fragmentation but with fixed size partitions suffers from internal fragmentation. Contiguous memory allocation does not support sharing code across processes. This is because the virtual memory segment of a process is not fragmented into non-contiguous fine grained blocks.

Paging:

Paging does not encounter external fragmentation as pages are of the fixed or equal size. So this reduces external fragmentation. However paging suffers from internal fragmentation. This is because a process can request more space or it can request for a less space. When page is allocated to the such a process that page is no longer utilized.This results in internal fragmentation because of the wastage of space even when the page has internal space but cannot be fully utilized. Paging allows to share code across processes.

5 0
2 years ago
In Section 8.5.4, we described a situation in which we prevent deadlock by ensuring that all locks are acquired in a certain ord
ruslelena [56]

Answer:

See Explaination

Explanation:

Separating this critical section into two sections:

void transaction(Account from, Account to, double amount)

{

Semaphore lock1, lock2;

lock1 = getLock(from);

lock2 = getLock(to);

wait(lock1);

withdraw(from, amount);

signal(lock1);

wait(lock2);

deposit(to, amount);

signal(lock2);

}

will be the best solution in the real world, because separating this critical section doesn't lead to any unwanted state between them (that is, there will never be a situation, where there is more money withdrawn, than it is possible).

The simple solution to leave the critical section in one piece, is to ensure that lock order is the same in all transactions. In this case you can sort the locks and choose the smaller one for locking first.

4 0
2 years ago
Which of the following describes an executive information system (EIS)?
rjkz [21]
I think the answer is b

hope this helps :)
3 0
2 years ago
Other questions:
  • Shaniya has misspelled a scientific name in her biology report. She needs to correct it, but she has no access to a computer. Sh
    13·2 answers
  • Explain the following instructions: ADD 3000, 1050, 1900.
    12·1 answer
  • The relational model describes data using a standard tabular format; all data elements are placed in three-dimensional tables ca
    5·1 answer
  • Polygon transform (25 points). Write a library of static methods that performs various geometric transforms on polygons. Mathema
    12·1 answer
  • Jennifer has written a short story for children. What should be her last step before she submits the story for publication?
    11·1 answer
  • Write a function named file_stats that takes one string parameter (in_file) that is the name of an existing text file. The funct
    7·1 answer
  • Given num_rows and num_cols, print a list of all seats in a theater. Rows are numbered, columns lettered, as in 1A or 3E. Print
    7·1 answer
  • As a security engineer, compare and contrast the pros and cons of deploying hetero vs homogenous networks. Which costs more? Whi
    6·1 answer
  • A Security team is working with a client to evaluate the security of data and IT functions that are most critical to the operati
    13·1 answer
  • Which are technical and visual demands that need to be considered when planning a project? Choose three answers
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!