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.
These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.'''
# Main method
input_file = open('shakespeare.txt')
for line in input_file:
# Run main method on program execution
if __name__ == "__main__":
By purchasing this solution you'll be able to access the following files: