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
Taya2010 [7]
3 years ago
13

Count the number of words in the string. A word is one or more non-blank characters separated by one or more blanks. My suggesti

on is to use a flag (a boolean variable) to indicate whether or not you are in a word. Then you know you have found a word when the flag indicates that you are in a word and the next character is a blank. Think about how you will know when you have found the end of a word, and what you should do with your flag at that point.
Computers and Technology
1 answer:
NikAS [45]3 years ago
7 0

Answer:

myString = input("Please enter a string")

wordList = myString.split()

numofWords = len(wordList)

print('The number of words in {} is {}'.format(myString, numofWords))

Explanation:

Since the suggestion to use a boolean variable flag is not compulsory, I have implemented it in another way.

Using python programming language, the input function is used to prompt the user to enter a string which is saved in a variable myString.

The string entered is converted into a list of all the words by spliting at the blank spaces and saved in the variable wordList

Next we count the number of words by obtaining the len of the list and output to the user

You might be interested in
Mr. Green maintains a spreadsheet containing data on all of his employees, including name, job profile, monthly salary, and home
marta [7]
The answer is C because he'll be able to search up the employees name then it will tell him all the information he needs along with their job profile
6 0
4 years ago
Dereck works for long hours on his computer. He frequently experiences physical strain by the end of the day because he does not
rjkz [21]
<span>keeping hands and wrists straight while typing</span>
3 0
3 years ago
Read 2 more answers
In Rizzati Corp, vice presidents in departments such as engineering, manufacturing, IT, and human resources report directly to t
Harrizon [31]

Answer: <em>Functional organizational structure.</em>

Explanation:

From the given case/scenario, we can state that Rizzati Corp has a functional organizational structure. Functional organizational structure is referred to as a structure which is used in order to organize employees. The employees are mostly grouped or organized based on their knowledge or specific skills. It tends to vertically structure each and every department or staff with specific roles from VP to sales and finance departments, to worker assigned to commodities or services.

7 0
3 years ago
Which computer can perform the single dedicated task? a. Which commuter can perform the function of both analog and digital devi
vredina [299]
<h3>a= hybrid computer can perform the function of both analog and digital computer</h3>
8 0
3 years ago
During wave motion, the motion of particles to one side of the rest position will be______ the motion to the other side of the r
DiKsa [7]
I think waves will be the same as the motion because their all going the same way if not im sorry and take the test again and pick b
5 0
3 years ago
Read 2 more answers
Other questions:
  • Each time the enter key is pressed, word creates a new paragraph. (points : 2) true false
    7·1 answer
  • Optimization Score is made up of over 50 recommendations to optimize Search campaigns.A. TrueB. False
    11·1 answer
  • At what point in a vulnerability assessment would an attack tree be utilized?
    9·1 answer
  • A(n) ______________________________ is a camera mount that uses the concept of a lever and fulcrum and allows a camera to be rai
    9·1 answer
  • What are the 6 external parts of a computer system
    5·1 answer
  • In your own words, what is pair-programming? What is the role of the driver? What is the role of the navigator? What are some be
    15·1 answer
  • The network team has well established procedures to follow for creating new rules on the firewall. This includes having approval
    15·1 answer
  • Characteristics of hybrid computer​
    11·1 answer
  • What is real time os ?​
    13·1 answer
  • Answering a questi
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!