To write a python program for getting the word count from a text.
PC Anaconda - Python 3.7
Open visual studio code
Create file with .py extension.
Start the program.
Write the code.
Run terminal for output of the given program.
End the program
'''
Developed by : P Sri Varshan
Register name : 22008051
'''
num_words = 0
with open('data.txt','r') as f1:
for i in f1:
words=i.split()
num_words+= len(words)
print("Number of words in the files = {}".format(num_words))
Thus the program is written to find the word count from a text.