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
Cerrena [4.2K]
3 years ago
5

Assume that sentence is a variable that has been associated with a string consisting of words separated by single space characte

rs with a period at the end. For example: "This is a possible value of sentence." Write the statements needed so that the variable secondWord is associated with the second word of the value of sentence . So, if the value of sentence were "Broccoli is delicious." your code would associate secondWord with the value "is" . (python)my answer wassecondWord = sentence.substr(sentence.find(" ") + 1)secondWord = secondWord.substr(0, secondWord.find(" "))but i am keep on getting error message saying ⇒ You almost certainly should be using: [ ] ⇒ We think you might want to consider using: : ⇒ Solutions with your approach don't usually use: , (comma)
Computers and Technology
1 answer:
Nezavi [6.7K]3 years ago
3 0

Answer:

When you are working with substrings in python you should treat the strings as lists, according to your answer the corrected code is given below:

sentence = "This is a possible value of sentence."

secondWord = sentence[sentence.find(" ")+1:]

secondWord = secondWord[0:secondWord.find(" ")]

print(secondWord)

Explanation:

#Define the value of the sentence for testing

sentence = "This is a possible value of sentence."

#Define a variable temp that starts when a blank space is find in the sentence to the end, sentence[n:] --> means everything in string after index "n"

temp = sentence[sentence.find(" ")+1:]

#Define the secondWord variable, you start at index 0 because in temp we already delete the first word and ends when finds the other blank space.

secondWord = temp[0:temp.find(" ")]

print(secondWord)

You might be interested in
4.2.5 codehs text messages answer
N76 [4]

Answer:

public class TextMessage

{

   private String message;

   private String sender;

   private String receiver;

   

   public TextMessage(String from, String to, String theMessage)

   {

       sender = from;

       receiver = to;

       message = theMessage;

   }

   

   public String toString()

   {

       return sender + " texted " + receiver + ": " + message;

   }

}

4 0
2 years ago
Unlike a virtual image, a real image
IRINA_888 [86]
C.cannot be viewed on a screen
4 0
3 years ago
Which approach does procedural programming follow? bottom up, top down, random, or object oriented​
ELEN [110]

Answer:

Top to down approach

Explanation:

7 0
3 years ago
Pls help I will give points
Fed [463]

Answer:

phone !!

Explanation:

since it's a mobile app, that would apply to a handheld device !!

i hope this helps !!

3 0
3 years ago
Read 2 more answers
You may have come across websites that not only ask you for a username and password, but then ask you to answer pre-selected per
raketka [301]

Answer:

The questions are used to secure and identify you furthermore. Answering personal questions that only you can answer will deter someone from hacking into your account that easily.

Explanation:

5 0
3 years ago
Other questions:
  • Question 1 of 20 :
    15·2 answers
  • [PROGRAMMING] A ____ signal indicates that a specific amount of time should pass before an action starts.
    13·1 answer
  • Which of the following barriers to oral communication is not the fault of the sender or receiver? being unprepared noise not pay
    12·2 answers
  • PLEASE HELP!!! THIS IS WORTH A TEST GRADE!!!
    13·1 answer
  • Is there a syntax error in the following code? bool hourlyWorker = true; if (hourlyWorker) cout << "The employee is an hou
    12·1 answer
  • Which of the selection below does not represent a workable IP address?
    9·1 answer
  • Even if you cannot afford it you should donate at least 5 of your earnings to charity true or false
    8·1 answer
  • Which of the following is not part of the four ways you can avoid problems with email communication?
    12·1 answer
  • Cuzzzzzzzzzzzzzzzz iiiiiiiiiiiiiiiii remember everytimeeeeeeeeee on these days that i feel like you and meeeeeeeeeeeeeee
    15·1 answer
  • Assume you are a manager in the security department of a high-tech corporation. You are mentoring Mary, an entry-level network t
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!