
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

Average Word Length Due by 10 p.m. on Wednesday 11/19, by electronic turn-in You MUST submit your work to the as6 folder corresponding to your lab class, or it will NOT be graded (e.g. if you are in lab class 023, you must submit your work to the folder as6_023). Remember to include your name, SID or SSN (last 4 digits), lecture & lab section numbers, lab login id, & ucr email address in the header of the file you submit (write them as comments). Write a program that will compute the average word length (average number of characters per word) for a file that contains some text. A word is defined to be any string of symbols that is preceded and followed by one of the following at each end: a blank, a comma, a period, the beginning of a line, or the end of a line. Your program should define a function that is called with the input-file stream as an argument. Use the name “textfile.txt” as your input file or allow the user to enter their own file name. Given this example input file: You’re program should output: Average word length: 3.5 characters I’m trying to free your mind, Neo. But I can only show you the door. You're the one who has to walk through it. textfile.txt