Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python 3 Coding Classes & Methods: Listed below are the three tasks I need help with. Thank you! A course represents a specific course record

Python 3 Coding Classes & Methods:

Listed below are the three tasks I need help with. Thank you!

image text in transcribed

A course represents a specific course record as those appeared on your transcript. class course: Define the course class. def_init_(self, number, credit, grade): Course constructor. All three parameters must be stored to instance variables of the same names (number, credit, and grade). number;; str. Represents course number, like "CS112" or "MATH113". credit;; int. Represents credit hours. You can assume it will always be a positive integer. grade;; str. Represents letter grade. Can only be 'A', 'B', 'C', 'D', 'F', or 'IP'. If the provided grade is not one of these (for example, grade == "K") then raise a CourseError with the message "bad grade 'K". (You can skip this exception-raising part until later). def_str_(self): returns a human-centric string representation. If number == "CS112", credit == 4, and grade == "A", then the returned string must be "CS112: credit 4, grade A" def_eq_(self, other): we want to check that two courses are equal (our self and this other def course). We compare each instance variable like so (this is the definition!) return self.number == other.number and self.credit == other.credit and self.credit==other.credit def is_passing (self): checks whether this course has passed or not according to grade. Return False if the grade is 'F' or 'IP'; return True otherwise

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_2

Step: 3

blur-text-image_3

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

More Books

Students also viewed these Databases questions