a=input("Enter the string paragraph:")
count=0
for i in a:
if i==" ":
count=count+1
print("Number of spaces in a string:",count)
Count the number of spacing logical program is working
a=input("Enter the string paragraph:")
count=0
for i in a:
if i==" ":
count=count+1
print("Number of spaces in a string:",count)
Count the number of spacing logical program is working
>>> a=input("Enter the value ")
Enter the value "My Testing String"
>>> a.count(' ')
2