Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

all this will help to implement score_students function In class Survey.. thanks asap! (also u do have to make sure nonetype is not assigned to

image text in transcribed

image text in transcribed

image text in transcribed

all this will help to implement score_students function In class Survey.. thanks asap! (also u do have to make sure nonetype is not assigned to len()), consider every case it should work and not work

thanks !

we need to finish make_grouping, and python lang

sorry I mean, finish score_students! has to be implemented.. finishing the body of it

S indow Help CSC148 [CAPuru\CSC148 COURSE\csc148) ... assignments\al\1\survey.py - PyCharm - 489 welcome.py i grouper.py survey.py in example tests.py course.py criterion.py tests.py X Survey 488 def score_students(self, students: List[Student])-> float: 490 491 Return a quality score for calculated based on their answers 492 to the questions in this survey, and the associated criterion and weight 493 for each question. 494 495 This score is determined using the following algorithm: 496 497 1. For each question in , find its associated criterion, weight, 498 and answers to this question. Use the score_answers method 499 for this criterion to calculate a quality score. Multiply this 500 quality score by the associated weight. 501 2. Find the average of all quality scores from step 1. 502 503 If an InvalidAnswerError would be raised by calling this method, or if 504 there are no questions in , this method should return zero, 505 === Precondition === 507 ALL students in @ _questions: Dict[int, Question] _criteria: Dict[int, Criterion _weights: Dict[int, int] _default_criterion: Criterion _default_weight: int def __init__(self, questions: List[Question)) -> None: Initialize a new survey that contains every question in questions). This new survey should use a homogeneousCriterion as a defouce criterion and should use 1 oso default weight. self._questions . () for question in questions: self._questions question.id) - question self._default_criterion - HomogeneousCriterion() self._default_weight - 1 self._weights - () self._criteria - () Eclass Student: A Student who can be enrolled in a university course. === Public Attributes === id: the id of the student name: the name of the student === Representation Invariants === name is not the empty string id: int name: str student_answers: Dict[Question, Answer] def init__(self, id_: int, name: str) -> None: *** Initialize a student with name and id *** self.name = name self.id = id_ self._student_answers = {} S indow Help CSC148 [CAPuru\CSC148 COURSE\csc148) ... assignments\al\1\survey.py - PyCharm - 489 welcome.py i grouper.py survey.py in example tests.py course.py criterion.py tests.py X Survey 488 def score_students(self, students: List[Student])-> float: 490 491 Return a quality score for calculated based on their answers 492 to the questions in this survey, and the associated criterion and weight 493 for each question. 494 495 This score is determined using the following algorithm: 496 497 1. For each question in , find its associated criterion, weight, 498 and answers to this question. Use the score_answers method 499 for this criterion to calculate a quality score. Multiply this 500 quality score by the associated weight. 501 2. Find the average of all quality scores from step 1. 502 503 If an InvalidAnswerError would be raised by calling this method, or if 504 there are no questions in , this method should return zero, 505 === Precondition === 507 ALL students in @ _questions: Dict[int, Question] _criteria: Dict[int, Criterion _weights: Dict[int, int] _default_criterion: Criterion _default_weight: int def __init__(self, questions: List[Question)) -> None: Initialize a new survey that contains every question in questions). This new survey should use a homogeneousCriterion as a defouce criterion and should use 1 oso default weight. self._questions . () for question in questions: self._questions question.id) - question self._default_criterion - HomogeneousCriterion() self._default_weight - 1 self._weights - () self._criteria - () Eclass Student: A Student who can be enrolled in a university course. === Public Attributes === id: the id of the student name: the name of the student === Representation Invariants === name is not the empty string id: int name: str student_answers: Dict[Question, Answer] def init__(self, id_: int, name: str) -> None: *** Initialize a student with name and id *** self.name = name self.id = id_ self._student_answers = {}

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

Database Concepts

Authors: David M. Kroenke, David J. Auer

7th edition

133544621, 133544626, 0-13-354462-1, 978-0133544626

More Books

Students also viewed these Databases questions