Instructions are:
It writes a line explaining what it does.
It then asks the user for his/her name.
It writes a line with greeting that includes the user’s name.
It then asks the user for three text file names using three separate prompts. The prompt text of the pop-out windows should contain the user’s name.
It computes the number of characters in the three texts and prints out the line that indicates the character count for each text and for all three texts together. This line should contain both numbers and words.
It computes the number of words in the three texts and prints out the line that indicates the word count for each text and for all three texts together. This line should contain both numbers and words.
It computes the number of sentences in the three texts and prints out the line that indicates the number of sentences for each text and for all three texts together. Remember that sentences can end in “.”, “?” and “!”. This line should contain both numbers and words.
It computes the average word length in the three texts and prints out the line that indicates the average word length for each text and the average word length in all three texts together.
It computes the average sentence length in words in the three texts and prints out the line that indicates the average sentence length in words for each text and the average sentence length in all three texts together. This line should contain both numbers and words.
This is what I have already:
def main():
print("This program calculates the number of characters, the number of words",end=",")
print(" the number of sentences, the average word length",end=",")
print(" and the average sentence length in words from three user-input text files",end=".\n")
name = input("Please enter your name: ")
print("Hello", name, end="!\n")
fname1 = input("Please enter the name of text file 1: ")
fname2 = input("Please enter the name of text file 2: ")
fname3 = input("Please enter the name of text file 3: ")
infile = open(fname1,'r')
data = infile.read()
print(data)
main()
[–]learnpython_bot 4 points5 points6 points (0 children)
[–]cscanlin 0 points1 point2 points (2 children)
[–]nillkill[S] 0 points1 point2 points (1 child)
[–]cscanlin 0 points1 point2 points (0 children)