Computer Science, asked by chilukasrikanth978, 4 days ago

Write a python program to count consecutive spaces as one

Answers

Answered by mukkubatra9509247621
0

Answer:

string = "This is an example text.\n But would be good if it worked."

counter = 0

for i in string:

if i == ' ' or i == '\n':

counter += 1

print(counter)

Explanation:

However, instead of returning with 15, the result should be only 11.

Similar questions