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
Pre-Test
ozzi

Some of the options in this question are not correct; here is the correct and complete question:

In order for a fictionalized story to be based on real events, the author should include

A. Characters with strong feelings

B. Historical material

C. A narrator

D. Dialogue​

The correct answer is B. Historical material

Explanation:

Stories, novels, and poems are said to be based on real events if these include or are inspired by real people, settings, or historical events. This includes using any historical material and adapting it to create a story. For example, the play "The Tragedy of Julius Caesar" written by Shakespeare is a play based on real events as it includes real characters such as Julius Caesar and some of the events in it are based on historical events.

According to this, the element that is necessary to make a story to be based on real events is historical material. Also, others such as a narrator, dialogue, or characters with strong feelings can be found in most stories including those that are completely fictionalized.

3 0
3 years ago
Is part of a computer's hardware that executes each instruction in a program?
zlopas [31]
The CPU, or central processing unit, is the hardware that takes most of the load when running a program. It will perform complex calculations and execute every instruction as the program continues.

The GPU, or graphics procession unit, is the hardware that could also play a major roll in calculating the instructions to execute a program, though this depends on how graphically intensive the program is. For example, games would use a lot more GPU power than say a simple calculator application.
7 0
3 years ago
Mbr and guid advantages and disadvantages
photoshop1234 [79]

Answer:

GPT does not have limitations in terms of the number of partitions. While you can have only 4 primary partitions in MBR, you can have up to 128 partitions in Windows using the GPT partition layout. GPT partition and boot data are more secure than MBR. MBR stores data in one place only.

Explanation:

I took the test

8 0
3 years ago
You are given a text file called "master" that is structured this way: the first line contains a string which is the name of a f
aniked [119]
When finished the corse code system is your code concerning your username password for payment
4 0
3 years ago
Described the importance of developing strategies to conduct educational research.
melamori03 [73]

Step 1: Identifying a Problem.

2

Step 2: Reviewing the Literature.

3

Step 3: Specifying a Purpose and Research Questions. Writing purpose statements, research questions, and hypotheses provide critical direction to an educational research study. ...

4

Step 4: Designing a Study.

ecu

5 0
2 years ago
Other questions:
  • Consider two different implementations, M1 and M2, of the same instruction set. There are three classes of instructions (A, B, a
    14·1 answer
  • Typically, you need to score _____ or higher on an AP exam to receive college credit for the AP course in the subject tested by
    11·2 answers
  • Why should you not perform any personal grooming task while driving?
    5·2 answers
  • What are the features of the Outline view in Word? Select three options.
    12·2 answers
  • Extinction of a species is always a negative impact on the Earth.<br><br> True<br> False
    8·1 answer
  • Company that offers Internet access to individuals and businesses. This device connects two or more networks and directs the flo
    11·1 answer
  • ASAP FAST PLSKara is currently creating a storyboard for her web site. Which step of the web design process is she in? Coding Pl
    9·2 answers
  • Look at the following function prototype. double mynewFunction(int); What is the data type of the function’s return variable?
    11·1 answer
  • Order the steps for accessing the junk email options in outlook 2016
    14·1 answer
  • Emma lives in Pennsylvania, what climate does she live in?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!