Language is Python
9.9 LAB: Count input length without spaces, periods, exclamation points, or commas

Given a line of text as input, output the number of characters excluding spaces, periods, exclamation points, or commas.

Ex: If the input is:

Listen, Mr. Jones, calm down.
the output is:

21

Answer :

stapmoshun

Answer:

text = input('Please enter a line of text')

text = text.replace(" ", "")

text = text.replace(".", "")

text = text.replace("!", "")

text = text.replace(",", "")

print(len(text))

Explanation:

i answered this same exact question the other day.

line by line, the first line asks for input with a prompt.

the second line replaces spaces, the next one replaces periods, the next exclamation marks, the next commas. then the last line prints the total number of characters

In this exercise we have to use the computer language knowledge in python to write the code as:

the code is in the attached image.

In a more easy way we have that the code will be:

text = input('Please enter a line of text')

text = text.replace(" ", "")

text = text.replace(".", "")

text = text.replace("!", "")

text = text.replace(",", "")

print(len(text))

See more about python at brainly.com/question/26104476

${teks-lihat-gambar} lhmarianateixeira

Other Questions