To write a python program for getting the word count from a text.
PC Anaconda - Python 3.7
with open('text.txt','r') as file1:
for i in file1:
word =i.split()
num_words += len(word)
print("Number of words={}".format(num_words))
Thus the program is written to find the word count from a text.