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
Amiraneli [1.4K]
2 years ago
15

Write the code to replace only the first two occurrences of the word second by a new word in a sentence. Your code should not ex

ceed 4 lines. Example output Enter sentence: The first second was alright, but the second second was long.
Enter word: minute Result: The first minute was alright, but the minute second was long.
Computers and Technology
1 answer:
Lapatulllka [165]2 years ago
8 0

Answer:

Explanation:

The following code was written in Python. It asks the user to input a sentence and a word, then it replaces the first two occurrences in the sentence with the word using the Python replace() method. Finally, it prints the new sentence. The code is only 4 lines long and a test output can be seen in the attached image below.

sentence = input("Enter a sentence: ")

word = input("Enter a word: ")

replaced_sentence = sentence.replace('second', word, 2);

print(replaced_sentence)

You might be interested in
Write a program that reads a list of integers into a vector, and outputs the two smallest integers in the list, in ascending ord
AnnyKZ [126]

Answer:

In C++:

#include <bits/stdc++.h>

#include <iostream>

#include <vector>

using namespace std;

int main(){

vector<int> vectItems;

cout << "Vector length: ";

int ln; cin>>ln;

int num;

for (int ikk = 0; ikk < ln; ikk++){

 cin >> num;

 vectItems.push_back(num);}

int small, secsmall;

small = secsmall = INT_MAX;  

for (int ikk = 0; ikk < ln; ikk++){

 if(vectItems[ikk] < small){

     secsmall = small;  

           small = vectItems[ikk];   }

 else if (vectItems[ikk] < secsmall && vectItems[ikk] != small) {

           secsmall = vectItems[ikk];} }

 cout<<small<<" "<<secsmall;

 return 0;}

Explanation:

See attachment for program file where comments are used for explanation

Download cpp
8 0
3 years ago
Robert's computer is not starting due to an error in the BIOS. Which of these chips could have malfunctioned? Select the correct
timofeeve [1]

Hi;

In the question, Robert gives the explanation that there is an error in the BIOS. A BIOS (Standing for Basic Input & Output System) is a ROM chip, and is vital for the computer to initialize devices such as RAM, the CPU, etc. If there is ever an error there, a computer simply cannot boot.

From the options given, your answer given would be C. ROM.

I hope this helps!

8 0
3 years ago
Movie Hidden Figures
Setler79 [48]

Answer:

D: 97

Explanation:

i watched this movie 3 times

4 0
2 years ago
SMTP (Simple Mail Transfer Protocol) is the standard protocol for transferring mail between hosts over TCP. A TCP connection is
ruslelena [56]

Answer:

The five rules are described as follows:

Rule A permits the inbound Simple Mail Transfer Protocol (SMTP) connection.

Rule B permits the inbound Simple Mail Transfer Protocol (SMTP) connection.

Rule C permits the outbound Simple Mail Transfer Protocol (SMTP) connection.

Rule D permits the outbound Simple Mail Transfer Protocol (SMTP) connection.

Rule E does not perform any action. Thus it is when the action is denied.

Explanation:

Rule A allows information transfer of the incoming email from the external server to the internal remote server, thus this allows an inbound connection.

Rule B allows information transfer of the incoming email from the remote server to the external remote server, thus this allows an inbound connection.

Rule C allows information transfer of outgoing email from the external server to the internal remote server, thus this allows an outbound connection.

Rule D allows information transfer of the outgoing email from the remote server to the external remote server, thus this allows an outbound connection.

Rule E does not allow any action in either direction thus it is when action is denied.

5 0
2 years ago
Think of a simple software project that requires your design skills. Specify the requirements needed on each design process
andrew-mc [135]

Answer:In this guide, we'll go over the basics of your software development ... I know which option I'd choose. ... Will you need to integrate with other tools or APIs? ... With the requirements in place, it's time to start designing what this ... In its most basic form, you can think of the Waterfall method as following each ...

Explanation:

4 0
3 years ago
Other questions:
  • Electric Bill Problem 3.0 (20 Points) What is the total cost of using the following at /kWh? a. 1600 W air conditioner for 6h b.
    11·1 answer
  • The file type ____ identifies a word 2013 document.
    11·1 answer
  • Please help!! Even if you help a little I will be very thankful!
    7·1 answer
  • Which phrase is a comparison operator for inserting a not equal to argument in an IF, COUNTIF or SUMIF function? &lt;= &lt;&gt;
    9·1 answer
  • When you are almost done with your soup and want to get at the last little bit, how should you do this 2
    5·1 answer
  • Evolucion de los sistemas operativos
    5·1 answer
  • Write a program that takes paragraph from the user and prints all unique words in that paragraph using strings in c++
    5·1 answer
  • Consider the following code segment.
    5·1 answer
  • Under the Home tab, controls for aligning text and objects can be found in the
    5·2 answers
  • Can someone be my friend,don't friend me until i ask you Questions
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!