So below is the question of the problem for my class. I have attached a picture of my python program and I keep getting than error message. I have also attached the list of the friends and age. using python Now write a program named filereader.py that reads and displays the data in friends.txt. This program should also determine and print the average age of the friends on file. That will require an accumulator and a counter. Use a while loop to process the file, print the data, and modify the accumulator and counter. Then close the file and display the average age accurate to one decimal place. See the Sample Output..
Please help,
So below is the question of the problem for my class. I have attached a picture of my python program and I keep getting than error message. I have also attached the list of the friends and age.
using python
Now write a program named filereader.py that reads and displays the data in friends.txt. This program should also determine and print the average age of the friends on file. That will require an accumulator and a counter. Use a while loop to process the file, print the data, and modify the accumulator and counter. Then close the file and display the average age accurate to one decimal place. See the Sample Output..
SAMPLE OUTPUT
My friend Denny is 24
My friend Penny is 28
My friend Lenny is 20
My friend Jenny is 24
Average age of friends is 24.0
I appreciate the help
Kevin
Step by step
Solved in 3 steps with 1 images