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
The what toolbar can be customized to the preferences of the user
schepotkina [342]
Is this a multiple choice question?
7 0
3 years ago
2. Write a simple program in C++ to investigate the safety of its enumeration types. Include at least 10 different operations on
erastovalidia [21]

Answer:

Check the explanation

Explanation:

To solve the question above, we will be doing some arithmetic and bit wise operations on enum values. in addition to that, we are asserting the array with INTCOUNT  and also printing the size of array i.e 12 and we are adding BIG_COUNT enum value to 5 and the result is 25.

#include<stdio.h>

enum EnumBits

{

ONE = 1,

TWO = 2,

FOUR = 4,

EIGHT = 8

};

enum Randoms

{

BIG_COUNT = 20,

INTCOUNT = 3

};

int main()

{

// Basic Mathimatical operations

printf("%d\n",(ONE + TWO)); //addition

printf("%d\n",(FOUR - TWO)); //subtraction

printf("%d\n",(TWO * EIGHT)); //multiplication

printf("%d\n",(EIGHT / TWO)); //division

// Some bitwise operations

printf("%d\n",(ONE | TWO)); //bitwise OR

printf("%d\n",(TWO & FOUR)); //bitwise AND

printf("%d\n",(TWO ^ EIGHT)); //bitwise XOR

printf("%d\n",(EIGHT << 1)); //left shift operator

printf("%d\n",(EIGHT >> 1)); //right shift operator

// Initialize an array based upon an enum value

int intArray[INTCOUNT]; // declaring array

// Have a value initialized be initialized to a static value plus

int someVal = 5 + BIG_COUNT; //adding constant and BIG_COUNT variable

printf("%d\n",someVal); //value will be 25

printf("%d",sizeof(intArray)); //value will be 12

return 0;

}

Kindly check the attached image below for the Code and Output Screenshots:

6 0
3 years ago
"which term is used to describe the process of encasing one protocol or packet inside another protocol or packet
svlad2 [7]
<span>tunneling Term used 
process of encasing one protocol or packet inside another protocol or packet</span>
7 0
3 years ago
Give two examples of safe, professional usernames. (1-2 sentences)
erastovalidia [21]

Answer:

Safe username

Explanation:

OKNGR$#1133

PLMOKNG^&*89

5 0
2 years ago
Which two protocols can be used to gain remote access specifically to a server's command line interface, securely and unsecurely
padilas [110]
Telnet and SSH are two protocols that can be used to gain remote access specifically to a server's command line interface.
7 0
3 years ago
Other questions:
  • Janelle is organizing an outline for an investigative report about the benefits of taking a 30-minute walk each day. which of th
    11·2 answers
  • OSI is a seven-layered framework used to help define and organize the responsibilities of protocols used for network communicati
    6·1 answer
  • ___ is a career discipline focusing on helping companies use computer technology effectively.
    12·1 answer
  • Which of the following Internet protocols is MOST important in reassembling packets and requesting missing packets to form compl
    11·1 answer
  • Taking an online class doesn't require any special skills.
    13·2 answers
  • Given a number count the total number of digits in a number
    12·1 answer
  • Professor Gig A. Byte needs to store text made up of the characters A with frequency 6, B with frequency 2, C with frequency 3,
    10·1 answer
  • Investigate the many ways that hardware and software can cause an interrupt to occur. Are ALL interrupts treated equally or do s
    13·1 answer
  • A Chain of dry-cleaning outlets wants to improve its operations by using data from devices at individual locations to make real-
    14·1 answer
  • Do you think that the TV set has outlived its utility as a household appliance? Research how convergence with internet technolog
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!