Question: Rewrite / finish the analyze function to print out: - the average number of comments across all posts - the average score of posts across
Rewritefinish the analyze function to print out:
the average number of comments across all posts
the average score of posts across all posts
what the highest score is and the title for that post
what the lowest score is and the title for that post
what the most commented post is with its title and number of comments
Note: The data contains posts and comments, and you must separate those for accurate results.
And following is a starter program that you can run using Python on your own computer. Note that you will need to have the CSV file in the same directory as your python script in order for this to work correctly.
import csv
def analyzeentries:
printffirst entry: entries
with openredditvmcsvr encoding'UTF errors"ignore" as input:
entries eid intescore intecommsnum' etitle for e in csvDictReaderinput
avgScore analyzeentries
Here is an example run of the program these are not the correct data values:
$ python main.py
Average score:
Average comments per post:
Highest score: title: Some post title
Lowest score: title: Some post title
Most comements: title: Some post title
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
