Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Assume that a file named record.txt contains a single dictionary object whose keys represent the names of students in CSC 1 3 0 and the
Assume that a file named record.txt contains a single dictionary object whose keys represent the names of students in CSC and the corresponding values are the the scores of students. This dictionary object has been serialized earlier to the file. Complete the following code that will
define a function that will load the dictionary object from the file and return the dictionary object.
define a function that accepts a dictionary object as an argument, removes every student whose score is zero from the dictionary object and returns the updated dictionary object.
define a function that accepts a dictionary object as an argument, calculates and displays the average score as a whole number.
import pickle as pk
def getDict:
fObj oper
def removeZerosdObj:
newdObj
for k v in items :
if :
return
def avgscoredObj:
totalscore
for in dObj:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started