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
Alla [95]
3 years ago
11

1. Assume that word is a variable of type String that has been assigned a value . Assume furthermore that this value always cont

ains the letters "dr" followed by at least two other letters. For example: "undramatic", "dreck", "android", "no-drip".
Assume that there is another variable declared , drWord, also of type String . Write the statements needed so that the 4-character substring word of the value of word starting with "dr" is assigned to drWord. So, if the value of word were "George slew the dragon" your code would assign the value "drag" to drWord.

2. Assume that sentence is a variable of type String that has been assigned a value . Assume furthermore that this value is a String consisting of words separated by single space characters with a period at the end. For example: "This is a possible value of sentence."

Assume that there is another variable declared , firstWord, also of type String . Write the statements needed so that the first word of the value of sentence is assigned to firstWord. So, if the value of sentence were "Broccoli is delicious." your code would assign the value "Broccoli" to firstWord.
Computers and Technology
1 answer:
s2008m [1.1K]3 years ago
4 0

Answer:

1.word = "George slew the dragon"

startIndex = word.find('dr')

endIndex = startIndex + 4

drWord = word[startIndex:endIndex]

2. sentence = "Broccoli is delicious."

sentence_list = sentence.split(" ")

firstWord = sentence_list[0]

Explanation:

The above snippet is written in Python 3.

1. word is initialized to a sentence.

Then we find the the occurence of 'dr' in the sentence which is assign to startIndex

We then add 4 to the startIndex and assign it to endIndex. 4 is added because we need a length of 4

We then use string slicing method to create a substring from the startIndex to endIndex which is assigned to drWord.

2. A string is assigned to sentence. Then we split the sentence using sentence.split(" "). We split based on the spacing. The inbuilt function of split returns a list. The first element in the list is assigned to firstWord. List uses zero based index counting. So. firstWord = sentence_list[0] is use to get first element.

You might be interested in
Valerie regularly generates sales reports from her organization's data warehouse. She uses these reports to create presentations
Luda [366]

Answer:

the answer is C

Explanation:

reporting tool because she has to report it before doing anything else.

5 0
3 years ago
Select the statements below that correctly match the meaning of the letter in the concept of developing SMART goals?
fenix001 [56]

Specific, Measurable, Attainable, Relevant and Timely.

6 0
3 years ago
What command can be used to export an nps backup file named npsconfig.xml that can be used to restore nps configuration on anoth
irakobra [83]

The command is Export-NpsConfiguration    

An admin can export the entire NPS configuration from one NPS for import to another NPS. Standard precautions should be taken when exporting NPS configurations over the network. The command syntax that can be used for exporting the NPS configurations is Export-NpsConfiguration –Path <filename>


3 0
3 years ago
Pls answer 10 points ​
AlekseyPX

Answer:

1. C

5.b

Explanation:

1. Is c because it is in the short cut key

5. Is B because it is the last choice

3 0
2 years ago
Read 2 more answers
Explain the procedure you will undertake to create a new partition​
MA_775_DIABLO [31]

To create a partition from unpartitioned space follow these steps:

Right click This PC and select Manage.

Open Disk Management.

Select the disk from which you want to make a partition.

Right click the Un-partitioned space in the bottom pane and select New Simple Volume.

Enter the size and click next and you are done.

8 0
3 years ago
Other questions:
  • How could the provisions in the new health reform bill improve access to care?
    14·1 answer
  • What is the property of the Magnetic Lasso tool?
    6·2 answers
  • Declare a character variable letterStart. Write a statement to read a letter from the user into letterStart, followed by stateme
    12·1 answer
  • HURRY
    5·1 answer
  • Can someone help me with this one
    9·2 answers
  • The person in charge of recording the sound should always
    15·1 answer
  • Which diagram is used as a popular technique for investigating causes and effects? 1. Cause and effect 2. Fishbone/lshikawa 3. R
    13·1 answer
  • -Define three types of user mode to kernel mode transfers?
    11·1 answer
  • What will be the output, if any, when the user clicks the right mouse button?
    5·1 answer
  • In C++ please (read the image below for instructions)
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!