Question: Python Pls Create a class called Table. Please Do question 1 - 4 class Table: 1) def __init__ 2) def add_record 3) def __call__ 4)

Python Pls

Create a class called Table.

Python Pls Create a class called Table. Please Do question 1 -

4 class Table: 1) def __init__ 2) def add_record 3) def __call__

Please Do question 1 - 4

class Table:

1) def __init__

2) def add_record

3) def __call__

4) def __getitem__

Define a class named Table in a module named table.py 0. Note that the module already includes the correctly written_str_and raw methods illustrated above, which you may use for printing/debugging. You may define additional (helper) methods in this class (but not functions in the module), but you do not have to define any, I didn't. You can write your own simple code to test your class in its script, and/or use the tests in the script or the large bsc.txt file tests supplied with the project. If you want to better see the exceptions raised, and their messsages, in the bsc.txt tests, uncomment the code before the call to driver.driver(). 1. Define an _init_method that has three parameters: 1. The name of the Table (a str) 2. The fields of the Table (a list of str) 3. The checks of the Table (a list of functions or lambdas) Important: You must store this information in the attibutes named self.name, self.fields, and self.checks. Also, you must bind the attribute named self.records to an empty list. Many batch self-check tests refer to these four attribute names directly, they will fail if you do not name these attributes correctly. The original Table above could be specified (initially, without any records) by the following call. employee - Table ("Employee', 'Name','EmpId', 'DeptName'], (lambda v: type (v) is str, lambda v: type (v) is int and 1000 at Ox021C44B0>, at Ox021C48E8>] self.records - [['Bob', 'Sales'], ['Cathy', 'Finance'], ['Alice', 'Finance'], ['David', 'Sales']] Raise an AssertionError exception with a simple, appropriate message, if any of the arguments is not a field in the Table, or any argument appears more than once. Define a class named Table in a module named table.py 0. Note that the module already includes the correctly written_str_and raw methods illustrated above, which you may use for printing/debugging. You may define additional (helper) methods in this class (but not functions in the module), but you do not have to define any, I didn't. You can write your own simple code to test your class in its script, and/or use the tests in the script or the large bsc.txt file tests supplied with the project. If you want to better see the exceptions raised, and their messsages, in the bsc.txt tests, uncomment the code before the call to driver.driver(). 1. Define an _init_method that has three parameters: 1. The name of the Table (a str) 2. The fields of the Table (a list of str) 3. The checks of the Table (a list of functions or lambdas) Important: You must store this information in the attibutes named self.name, self.fields, and self.checks. Also, you must bind the attribute named self.records to an empty list. Many batch self-check tests refer to these four attribute names directly, they will fail if you do not name these attributes correctly. The original Table above could be specified (initially, without any records) by the following call. employee - Table ("Employee', 'Name','EmpId', 'DeptName'], (lambda v: type (v) is str, lambda v: type (v) is int and 1000 at Ox021C44B0>, at Ox021C48E8>] self.records - [['Bob', 'Sales'], ['Cathy', 'Finance'], ['Alice', 'Finance'], ['David', 'Sales']] Raise an AssertionError exception with a simple, appropriate message, if any of the arguments is not a field in the Table, or any argument appears more than once

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!