How would I go about counting the words in a sentence? I\'m using Python.
For example, I might have the string:
string = \"I am having a very
How about using a simple loop to count the occurrences of number of spaces!?
txt = "Just an example here move along" count = 1 for i in txt: if i == " ": count += 1 print(count)