Question: Write a Python program that analyzes the characters in a text file (text1.txt - included below * ) and while also including at least one

Write a Python program that analyzes the characters in a text file (text1.txt - included below*) and while also including at least one try-except error handling statement block, calculates the following: 

 

  • The number of words in the text file
  • The number of uppercase letters in the text file
  • The number of lowercase letters in the text file
  • The number of digits in the text file
  • The number of whitespace characters in the file

*The text file that needs to be read in this case - named text1.txt - includes the following information:

 

I'm Henery The Eighth, I Am! Henery The Eighth, I Am, I am! I got married to the widow next door, She's been married seven times before. And ev'ryone was a Henery, She wouldn't have Willie or a Sam. I'm her eighth old man named Henery, Henery the Eighth, I Am! Second verse same as the first! I'm Henery The Eighth, I Am! Henery The Eighth, I Am, I am! I got married to the widow next door, She's been married seven times before. And ev'ryone was a Henery, She wouldn't have Willie or a Sam. I'm her eighth old man named Henery, Henery the Eighth, I Am! H-E-N-E-R-Y Henery, Henery, Henery The Eighth, I AM. I am!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!