To write a python program for getting the word count from a text.
PC Anaconda - Python 3.7
Get the string from user
count will check repeated words in given string
use split() to split the string
now check every word in string
print the count
End the program
# Developed by : souvik kundu
# Register no. : 21001557
num_words =0
with open('test.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.