Skip to content

prithvi733/Word-Count-

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 

Repository files navigation

EX-9 Word-count

Date:

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:

Open the file in read mode and handle it in text mode

Step 2:

Read the text using read() function.

Step 3:

Read the text using read() function.

Step 4:

Read the text using read() function.

Step 5:

You can refine the count by clearing the string prior t splitting or validatting the words after splitting

Step 6:

PROGRAM:

import sys
count= 0
with open(sys.argv[1],'r') as f1:
    for line in f1:
        word= line.split()
        count += len(word)
print("word count in file = ",count)

OUTPUT:

word count

RESULT:

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published