Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in python I have added the assesment class below as well as the structure for the function below: You are required to complete the read_assessment_solution

in python I have added the assesment class below as well as the structure for the function below:

image text in transcribedimage text in transcribedimage text in transcribed

You are required to complete the read_assessment_solution (filename) function which takes a filename as a parameter, reads a list of answer keys per assessment and returns a list of Assessment objects. If the file doesn't exi you should tell the user that the file cannot be found. Implement this behaviour using exception handling (File NotFoundError). For example, the following code fragment assessment list read_assessment_solution ('solution.txt') for assessment in assessment list: print (assessment) prints: labl: answer: ['c', 'C', 'D', 'B', 'A', 'B', 'A', 'C', 'B'] lab2 : answer: ['B', 'D', 'D', 'B', 'D', 'A', 'B', 'A', 'A'] lab3: answer: ['D', 'D', 'D', 'A', 'C', 'C', 'B', 'B', 'B'] defget aansweran MMM class Assessment: #works def init (self.name, answer_keys): self. name = name self. _answer_list = answer_keys.split(',') #accessor def.get_name(self): return self. name answer_list(self): return self. _answer_list #mutator def set_name(self, name) : self.name = name def calculate_marks(self, data): marks = 0 data_list = data.split(',') for i in range(0, len(self._answer_list)): if data_list[i].strip(). self._answer_list[i].strip(): marks += 1 elif self. _answer_list[i].strip() marks+= 0 else: marks+=0 return marks def stromself): return "{}: answer: {}".format(self._name, str(self._answer_list)) def read_assessment_solution(input_filename): try: except: assessment_list = read_assessment_solution('solution. txt') for assessment in assessment_list: print(assessment)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data Systems A 360-degree Approach

Authors: Jawwad ShamsiMuhammad Khojaye

1st Edition

0429531575, 9780429531576

More Books

Students also viewed these Databases questions

Question

What is the difference between Needs and GAP Analyses?

Answered: 1 week ago

Question

What are ERP suites? Are HCMSs part of ERPs?

Answered: 1 week ago