Must be done in python: You need to complete the function: one original and one
ID: 3877209 • Letter: M
Question
Must be done in python:
You need to complete the function: one original and one modified (please include both)
The classes used for this are as follows:
Also, I feel there is a better way to code the assessment class, below is the requirements for the assessment class and test cases and required outputs. could you please make the required changes
You are required to complete the read_data(assessment, classlist) function which takes an Assessment object and a list of student objects as parameters. The function should read a series of student responses. You can assume that all student responses of an assessment are stored in a text file and the filename is the name of the assessment. The function should compare the responses with the solution of the assessment for each student, calculate the marking result, append the marking result into a histogram object and return it. For example Test Result | s-Student( 'John', 'N00000001', 'john@amail.com') classlist[s] assessment Assessment( 'test, 'C,C,D,B,A,B,A,C') histogram-read-data(assessment, classist) print(histogram) max-mark: 8, occurrence : [O, , 1, 0, 0, 0, 0, 0,Explanation / Answer
The code modified in Assessment class:
class Assessment:
def __init__(self,name,answer_list):
self.__name=name
self.__answer_list=answer_list.split(',')
def get_name(self):
return self.__name
def set_name(self,name):
self.__name=name
def get_answer_list(self):
return self.__answer_list
def set_answer_list(self,answer_list):
self.__answer_list=answer_list.split(',')
def calculate_marks(self,answers):
marks=0
user_answers=answers.split(',')
if(len(user_answers)!=len(self.__answer_list)):
return "Not Enough Answers"
for i in range(0,len(user_answers)):
if(user_answers[i]==self.__answer_list[i]):
marks+=1
return marks
NOTE: You didnt give your code to modify read_data(assessment,class) method.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.