Open and read from the file line by line. And print out each to the terminal.
Open and read the file character by character. If the char is a letter or space, write it into a new file. If it is not a letter or space, skip. At the end of your program, there should be a new file with only letters and spaces left.
(tip: you can either create a list of elements (letters and space) to compare each character or you can use the ord() function to get the ASCII value of each character to see if it is a letter or space, you can find the ASCII table easily searching on google).
Write a program that counts the number of words in the file from question 02. Since we only have letters and spaces in the file, you can assume that each word is separated by a space. Hence, you can just count the number of spaces in each line. Also to remember, the last word in a line doesn't have the following space, so you need to handle that by adding an extra word count for each line.
This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.'''
# Main method
input_file = open('shakespeare.txt')
for line in input_file:
# Run main method on program execution
if __name__ == "__main__":