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
A bubble starts by comparing the first item in the list to all the remaining items, and swaps where the first item is ____ a lat
Alina [70]

Answer:

greater than

i think

5 0
2 years ago
Read 2 more answers
The function known as "Comments" can be displayed during a presentation<br>O True<br>False​
Sonja [21]

Answer:

false

Explanation:

Select the comment icon. on the slide. The Comments pane will open and you can see comments for that slide.

Select Reply to respond to a comment.

Select the Next or Back buttons to go between comments and slides.

3 0
3 years ago
Read 2 more answers
Write a program that reads an integer, a list of words, and a character. The integer signifies how many words are in the list. T
MrMuchimi

In python 3.8:

user_input = input().split()

x = user_input[0]

char = user_input[-1]

for w in range(1,int(x)+1):

   if char in user_input[w]:

       print(user_input[w])

I hope this helps

7 0
2 years ago
Byte pair encoding is a data encoding technique. The encoding algorithm looks for pairs of characters that appear in the string
nika2105 [10]

Answer:

The encoding algorithm looks for pairs of characters that appear in the string more than once and replaces each instance of that pair with a corresponding character that does not appear in the string. ... Byte pair encoding is an example of a lossy transformation because it discards some of the data in the original string.

Explanation:

hope it helps!!

6 0
2 years ago
Can you shoot video on the Olympus E-410?
Masja [62]
Yes you must update or do something first but then you can
6 0
3 years ago
Read 2 more answers
Other questions:
  • Which type of object is used to organize and store data in Microsoft access 2013
    5·2 answers
  • What software development model focuses on improving the product in small steps each time through the cycle?
    14·2 answers
  • Ecommerce sites sell this to generate income
    11·1 answer
  • What is the TAG to begin a Web page, as recommended by the W3C?
    13·1 answer
  • At Chicago Cubs games, residents across the street from Wrigley Field can watch the game from their apartment windows. Many of t
    14·1 answer
  • Rtjfifjjir<br> jhjjbkjkjjgggjhvhjvhf
    9·1 answer
  • PowerPoint is best described as:
    13·1 answer
  • Which of the following terms means the computer operating system automatically detects and installs the proper driver for a new
    9·1 answer
  • ________ is the art of manipulating people into breaking normal security procedures or divulging confidential information.
    12·1 answer
  • A user calls to report that she’s unable to log on to e-mail, and you ask a couple of questions. Because you know that no one el
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!