Write a text analyzer program using Python.
The program should prompt the user for text to analyze using the following prompt:
Please enter text to analyze or press ENTER (without text) to exit:
If the following text is input into by the user:
Fog everywhere. Fog up the river, where it flows among green
aits and meadows; fog down the river, where it rolls deified among
the tiers of shipping and the waterside pollutions of a great (and
dirty) city. Fog on the Essex marshes, fog on the Kentish heights.
Fog creeping into the cabooses of collier-brigs; fog lying out on
the yards and hovering in the rigging of great ships; fog drooping
on the gunwales of barges and small boats. Fog in the eyes and
throats of ancient Greenwich pensioners, wheezing by the firesides
of their wards; fog in the stem and bowl of the afternoon pipe of
the wrathful skipper, down in his close cabin; fog cruelly pinching
the toes and fingers of his shivering little apprentice boy on deck.
Chance 23 people on the bridges peeping over the parapets into a
nether sky of fog, with fog all round them, as if they were up in a
balloon and hanging in the misty clouds.
The program will output:
Count of characters: 901
Count of spaces: 163
Count of digits: 2
Count of letters: 715
Count of sentences: 6
Please enter text to analyze or ENTER (without text) to exit:
It is a type of fundamental question in python. Following is the code, which works perfectly with any type of paragraph and will give you the correct analysis.
You can copy this code and paste in your python terminal /shell /jupyter-notebook /online compiler etc.
NOTE: Python uses indentation to identify whether a statement is under a for loop, while loop or inside an if-else statement. Be careful while pasting and running the code.
" # " symbol is used to provide comments in the code.
-------------------------------------------------------------------------------------------------------------------------------------------------------------
while True: #starting a while loop so that unless user will not
press Enter key, code will keep analyzing new inputs
str1 = input("Please enter text to analyze or press ENTER (without text) to exit: ")
if str1 == "" :
exit()
characters = 0
space = 0
Sentance = 0
letters = 0
digits = 0
for i in str1 :
characters = characters +1
if i ==' ':
space = space + 1
if i.isalpha() == True:
letters = letters + 1
if i.isdigit() == True:
digits = digits + 1
if i =='.':
Sentance = Sentance + 1
print('Count of characters:' +" "+ str(characters))
print('Count of spaces:' +" "+ str(space))
print('Count of digits:' +" "+ str(digits))
print('Count of letters:' +" "+ str(letters))
print('Count of sentences:' +" "+ str(Sentance))
-----------------------------------------------------------------------------------------------------------------------------------------------
Write a text analyzer program using Python. The program should prompt the user for text to...
Using Python, write a program that keeps asking the user for text until they type "exit" To Exit Or Not Write a program that keeps asking the user for text until they type "exit" Console 1 Enter number 1 3 Enter number 5 5 Enter number 7 Enter number 8 1 9 Enter number 10 9 11 Enter number 12 3 13 Enter number 14 4 15 Enter number 16 exit 17 Bye! 18
Write python program using IDLE Write a full program that asks the user to enter his/her name then repeatedly ask to enter the temperature in Fahrenheit and convert it to Celsius, the program should then prompt the user if he/she wants to continue or exit the program. The formula for the conversion is: °C = (°F - 32) x 5/9 The program should use a function for the conversion. An Example of a sample run should appear on the screen...
Please write this in C. Write this code in Visual Studio and upload your Source.cpp file for checking (1) Write a program to prompt the user for an output file name and 2 input file names. The program should check for errors in opening the files, and print the name of any file which has an error, and exit if an error occurs opening any of the 3 For example, (user input shown in caps in first line) Enter first...