a = input("Enter the string paragraph:")
count = 0
for c in a:
if c == " ":
count += 1
print("Number of spaces in a string:", count)
How do I count the number of spaces?
a = input("Enter the string paragraph:")
count = 0
for c in a:
if c == " ":
count += 1
print("Number of spaces in a string:", count)
How do I count the number of spaces?
>>> a=input("Enter the value ")
Enter the value "My Testing String"
>>> a.count(' ')
2