Skip to content

naveenaakumarasamy/Word-count

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Word-count

AIM:

To write a python program for getting the word count from a text.

EQUIPEMENT'S REQUIRED:

PC Anaconda - Python 3.7

ALGORITHM:

Step 1:

assign value for num_word

Step 2:

open the file in read mode

Step 3:

iterate using for loop

Step 4:

increment the word with length of the word

Step 5:

print the number of words in text

PROGRAM:

num_word=0
with open("My File.txt","r")as file1:
    for i in file1:
        word=i.split()
        num_word+=len(word)
print("number of words {}".format(num_word))

OUTPUT:

word count

word count 1

RESULT:

Thus the program is written to find the word count from a text.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors