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
How does Frankenstein feel about his creation?
velikii [3]

Answer:

he just regrets that he made a monster and deeply feels guilty that it is in pain of reliving

Explanation:

8 0
3 years ago
Write about storage<br>(should be in easy words)​
enyata [817]

Answer:

Answer to the following question is as follows;

Explanation:

The process of storing digital information in a data storage media using computing technology is known as storage. Storage is a technique that allows a computer to keep data indefinitely or intermittently. Computer storage capacity and electronic data management are other terms for storage.

6 0
2 years ago
Problem 1 (Authentication): Consider the following authentication protocol, which uses a classical cryptosystem. Alice generates
Elis [28]

Answer:

Check the explanation

Explanation:

Yes, going by the question above, the protocol validates Bob to Alice for the reason that the key is only shared between Bob and Alice as well as the number which is being sent randomly. Therefore the invader won’t be able to predict and response to that number. Because of the authentication protocol, that makes use of a classical cryptosystem thereby resulting into the possibility of an argument such that key finding is attainable via invader.

5 0
3 years ago
Variables make it easier to do what?
defon
<span>D. Make changes to your code
Variables allow the ability to easily substitute numbers for other numbers.
</span>
8 0
3 years ago
Four ways to improve the performance of a hard disk include.
erik [133]

Answer:

Defragmenting, and optimizing, also on Windows to not use Paging unless you have an SSD. And to install a lightweight OS like Windows 11 super-lite, Linux etc.

7 0
2 years ago
Other questions:
  • To what device, inside the computer, do all other devices connect
    10·2 answers
  • How often are computer and user policies applied after a user has logged into a computer?
    15·1 answer
  • As the demand for goods and services increases, job growth _____. a. increases b. decreases c. remains the same d. none of the a
    15·2 answers
  • Siva added a "Contact Form" to her website.
    10·1 answer
  • What is Administrator windows 10
    8·1 answer
  • What is application software? A computer language for accessing data in a database. A character string used to identify the loca
    10·1 answer
  • How to find out what windows version i have?
    10·1 answer
  • Can maybe someone play with me on Over-watch on the Xbox?
    8·1 answer
  • Give me 4 examples of things to consider as a sound designer?<br> HURYYYYY IM TIMED
    11·1 answer
  • Why Use LinkedIn AI Automation Tools to Grow Your Sales Pipeline?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!