Write a python program to count consecutive spaces as one
Answers
Answered by
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