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
DanielleElmas [232]
4 years ago
14

5.15 LAB: Count input length without spaces, periods, or commas Given a line of text as input, output the number of characters e

xcluding spaces, periods, or commas. Ex: If the input is:
Computers and Technology
2 answers:
strojnjashka [21]4 years ago
7 0

Answer:

Following are the code to this question:

userVal = input()#defining a variable userVal for input the value

x= 0#defining variable x that holds a value 0

for j in userVal:#defining for loop to count input value in number

   if not(j in " .,"):#defining if block that checks there is no spaces,periods,and commas in the value

       x += 1#increment the value of x by 1

print(x)#Print x variable value

Output:

Hello, My name is Alex.

17

Explanation:

In the above-given code, a variable "userVal" is defined that uses the input method for input the value from the user end, in the next line, an integer  variable "x" is defined, hold value, that is 0, in this variable, we count all values.

  • In the next line, for loop is defined that counts string value in number and inside the loop an if block is defined, that uses the not method to remove spaces, periods, and commas from the value and increment the value of x by 1.
  • In the last step, the print method is used, which prints the calculated value of the "x" variable.    

 

Vlad1618 [11]4 years ago
6 0

Answer:

Explanation:#include <iostream>

#include<string>

using namespace std;

int main()

{

  string str;

   

cout<<"Enter String \n";

 

getline(cin,str);/* getLine() function get the complete lines, however, if you are getting string without this function, you may lose date after space*/

 

  //cin>>str;

 

  int count = 0;// count the number of characeter

  for (int i = 1; i <= str.size(); i++)//go through one by one character

  {

     

   

   if ((str[i]!=32)&&(str[i]!=44)&&(str[i]!=46))//do not count  period, comma or space

{

          ++ count;//count the number of character

      }

  }

  cout << "Number of characters are  = "; //display

cout << count;// total number of character in string.

  return 0;

}

}

You might be interested in
OSHA standards appear in the ___________ and are then broken down into ____________.
miskamm [114]
OSHA standards appear in the <span>Code of Federal Regulations (CFR) and are then broken down into Parts</span>
3 0
3 years ago
There are 5 houses in a row and in 5 different colors.
tankabanditka [31]
What’s the question?
5 0
4 years ago
How to turn off location on iphone without person knowing
andrezito [222]

Answer:

airplane mode

Explanation:

5 0
3 years ago
Write two functions var_input() and volume(), where var_input() accepts the input of the radius of a sphere and volume() returns
astra-53 [7]

Answer:

Program :

def var_input(): #input function which takes the radius as input.

 radius= float(input("Enter the radius of the sphere")) #statemet to take the inputs.

 volume(radius)  /#call the volume function.

def volume(radius):  #definition of volume function.

   print("The volume of the sphere is :"+"{:.2f}".format((4/3)*(22/7)*radius*radius*radius)) # print the volume of the sphere.

var_input() # calling the input function.

Output:

  • If the user inputs 4, then he will gets "268.19" as the output.
  • If the user inputs 5, then he will gets "523.81" as the output.

Explanation:

  • The above code is in python language, in which the first line is used to call the function.
  • Then the first line of the input function is used to render the message to the user and take the inputs from the user and store it into the radius variable.
  • Then the second line calls the volume function by passing the radius value.
  • Then the volume function calculates the volume and prints it.
6 0
4 years ago
which of the following is required to establish a new network switch and configure its IP address for the first time
dlinn [17]

Out-of-band management is required to establish a new network switch and configure its IP address for the first time.

<h3>What is Out-of-Band management?</h3>

Out-of-Band management is known to be a form of services that makes sure that a tech do not require to be sent onsite and it is one where remediation can be done in a remote place.

Hence,  Out-of-band management is required to establish a new network switch and configure its IP address for the first time.

See full question below

Which of the following is required to establish a new network switch and configure its IP address for the first time?

A. Client-to-site VPN

B. Site-to-site VPN

C. Out-of-band management

D. In-band management

Learn more about IP address from

brainly.com/question/24930846

#SPJ1

6 0
2 years ago
Other questions:
  • How does sea floor spreading relate to supercontinents? A. It lowers the overall water level in the ocean so land masses can joi
    13·2 answers
  • A laptop computer communicates with a router wirelessly, by means of radio signals. the router is connected by cable directly to
    10·1 answer
  • Which king, after finding the decree of Cyrus giving the Jews permission to return and build the Temple, ordered the end of oppo
    11·2 answers
  • Create a list with 5 numbers and find the smallest and largest number in the list and also the sum and product of the numbers in
    9·1 answer
  • Help? brainliest and point
    15·1 answer
  • DO YOU EVER FEEL LIKE A PLASTIC<br> DRIFTING THROUGH THE WIND, WANTING TO START AGAIN
    6·2 answers
  • What is web browser <br>​
    7·2 answers
  • The science of networking is attributed to which government's involvement?
    11·1 answer
  • O
    14·1 answer
  • Is this statement true or false? While in slide show mode, if you are not careful you can close the application by clicking the
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!