Skip to content

BlackCoder56/word_counter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“ Word Counter Script

This is a simple Python script that counts the number of words in a given text file.

πŸ“Œ Features

Prompts the user to enter a file name.

Checks if the file exists before reading.

Reads the file content and counts the total number of words.

Handles missing files gracefully without crashing.

πŸ› οΈ Requirements

Python 3.x

πŸš€ How to Use

Save the script as word_counter.py.

Run the script:

python3 word_counter.py

Enter the name of the file you want to analyze (make sure it's in the same directory or provide the full path).

The script will display the number of words in the file.

πŸ“‚ Example

Enter file name: sample.txt

Output

There are 120 words in sample.txt file.

⚠️ Notes

If the file does not exist, the script will print:

Output

File doesnot exist

About

In python3

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages