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
What is the best use of a line chart?
lapo4ka [179]
Line graphs can also be used to compare changes over the same period of time for more than one group. Pie charts are best to use when you are trying to compare parts of a whole. They do not show changes over time. Bar graphs are used to compare things between different groups or to track changes over time.
3 0
3 years ago
What are the uses of DVD Ram​
Verdich [7]

Answer:

Like ordinary random access memory (RAM), it can be repeatedly read, written to, and erased. Intended mostly for removable computer storage, DVD-RAM provides the capabilities of Rewriteable CD (CD-RW) - users can run programs from the discs, copy files to them and rewrite or delete them.

4 0
3 years ago
Read 2 more answers
3 component of a computer
madam [21]

Answer:

Hardware

software

Humanware

6 0
4 years ago
What happens when your computer is in Hibernate mode?
marusya05 [52]
It keeps you logged in to everything but it turns the screen off to save power.
8 0
3 years ago
How to reply to text from unknown number?
Leto [7]
Safest way: DO NOT reply and BLOCK number.

If you are not sure if the guy is related to some stuff, it will be better to call him back, instead of texting.
5 0
3 years ago
Other questions:
  • A company has decided to re-introduce a retro-radio by reproducing a product that was manufactured in the 1940s. The company has
    5·1 answer
  • Implement the function maxLoc(), which returns an iterator at the largest element in a list. template typename list::iterator ma
    14·1 answer
  • Your database was damaged due to hardware failure. What can you use to restore it?
    5·1 answer
  • What type of link is used to call this file?
    8·1 answer
  • Setting up network encryption involves
    5·1 answer
  • The arguments in a method call are often referred to as ____ . The variables in the method declaration that accept the values fr
    10·1 answer
  • James would like to send a document he has saved on the hard drive to coworkers in Ireland, Brazil, and India. These coworkers h
    6·2 answers
  • Worth 30 pts
    9·2 answers
  • What is analog computer?​
    14·1 answer
  • A process spawning or initiating another process is referred to as _____
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!