To write a python program for getting the word count from a text.
PC Anaconda - Python 3.7
Decleare number of words is 0
open it with txt file
Give range for i
Then nxt split the words
count the number of words
Giving print statement for getting output
#Program to find the Word Count
#Developed by : JANANI S
#Register Number : 23013409
num=0
with open("file1.txt","r") as f1:
for i in f1:
word=i.split()
num += len(word)
print("The number of words are in the file is ",num)
Thus the program is written to find the word count from a text.