Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

python 3.6 Task 1 - Grade A Grade represents a specific score on a specific kind of assessment (and has its own assumedly unique name).

python 3.6

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Task 1 - Grade A Grade represents a specific score on a specific kind of assessment (and has its own assumedly unique name). This is just a "container" type, used to give memorable names to individual grouped sub-values. class Grade: Define the Grade class. def init__(self, kind, name, percent) Grade constructor. All three parameters must be stored to instance variables of the same names (kind, name, and percent). If kind is not one of "test", "lab", "project", or "final" (example: kind--"survey"), then raise a GradingError with the message "no Grade kind ' survey'"(You can skip this exception-raising part until later) o kind :: str. Should be something like "lab", "test", or "project". o name :: str. Could be something like "L1", "T2", or "P6". o percent int. (I chose int to simplify the assignment, but float would have been useful). def_str_(self): returns a human-centric string representation. If kind-"test", name -"T1", and percents-97, then the returned string must be "test:T1(97%)" (no padded zeroes). def-repr want to construct a string that could be pasted back into the interactive mode to re-create this object. Given the same example as in__str_we need to return the string "Grade( ' test' , 'T1' , 97) ". Note: we choose to always use single-quotes. def_eq_(self, other): we want to check that two grades are equal (our self and this other grade). We compare each instance variable like so (this is the definition!) (self): returns a computer-centric string representation. As is often the case, we . return self, kind=-other.kind and self.name--other.name and self . percents-other. percent

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

The Manga Guide To Databases

Authors: Mana Takahashi, Shoko Azuma, Co Ltd Trend

1st Edition

1593271905, 978-1593271909

More Books

Students also viewed these Databases questions

Question

In an Excel Pivot Table, how is a Fact/Measure Column repeated?

Answered: 1 week ago