Text Counter Program Description:
This Python program allows users to count either the number of words or characters in a given text.
Users can choose between word count
('w') or character count
('c').
User Input Prompt:
The program prompts the user to enter their text and choose whether they want to count words or characters.
Counting Logic:
Based on the user's choice, the program calculates either the word count (using split()
) or the character count (using len()
).
Result Display:
After counting, the program displays the count (word count or character count) to the user.
Repeat Option:
The program asks the user if they want to count again. If the user chooses not to continue ('n'), the program exits the loop.
Usage:
Execute the program in a Python environment. Follow the prompts to enter your text and choose whether you want to count words or characters. You can continue counting by entering 'y' or exit the program by entering 'n'.