InstructionsYou will need to create three files:Apartment.py - file containing a class definition for an Apartment objectlab06.py - file containing mergesort and other functions defined in the lab06.py section of this lab.testFile.py - file containing pytest functions testing the overall correctness of your class definitionsThere will be no starter code for this assignment, but rather the class descriptions and required methods are defined in the specification below.You should organize your lab work in its own directory. This way all files for a lab are located in a single folder. Also, this will be easy to import various files into your code using the import / from technique shown in lecture.Apartment.py classThe Apartment.py file will contain the definition of an Apartment. We will define the Apartment attributes as follows:rent - integer that represents the rent of the ApartmentmetersFromUCSB - integer that represents the Apartment’s distance, in meters, from UCSBcondition - string that represents the condition of the Apartment. This string will be one of three options: "bad", "average", or "excellent".You should write a constructor that allows the user to construct an apartment object by passing in values for all of the fields. You may assume that all attributes of the Apartment object will be defined. Therefore, there should be no default values for rent, metersFromUCSB, or condition.__init__(self, rent, metersFromUCSB, condition)In addition to your constructor, your class definition should also support “getter” methods that can receive the state of the Apartment object:getRent(self)getMetersFromUCSB(self)getCondition(self)You will also implement the methodgetApartmentDetails(self)that returns a str with all of the Apartment attributes. The string should contain all attributes in the following EXACT format (Note: There is no \n character at the end of this string):a0 = Apartment(1204, 200, "bad")print(a0.getApartmentDetails())Output(Apartment) Rent: $1204, Distance From UCSB: 200m, Condition: badLastly, your Apartment class should overload the >,<, and == operators. This will be used when finding the proper position of an Apartment in the list using the specifications in the Introduction section of this lab. In this context for example, the < operator will return True for Apartment1 < Apartment2 if Apartment1 is better than Apartment2. We reviewed operator overloading in class and the textbook does discuss overloading Python operators. You can also refer to this reference on overloading various operators as well:
Question
InstructionsYou will need to create three files:Apartment.py - file containing a class definition for an Apartment objectlab06.py - file containing mergesort and other functions defined in the lab06.py section of this lab.testFile.py - file containing pytest functions testing the overall correctness of your class definitionsThere will be no starter code for this assignment, but rather the class descriptions and required methods are defined in the specification below.You should organize your lab work in its own directory. This way all files for a lab are located in a single folder. Also, this will be easy to import various files into your code using the import / from technique shown in lecture.Apartment.py classThe Apartment.py file will contain the definition of an Apartment. We will define the Apartment attributes as follows:rent - integer that represents the rent of the ApartmentmetersFromUCSB - integer that represents the Apartment’s distance, in meters, from UCSBcondition - string that represents the condition of the Apartment. This string will be one of three options: "bad", "average", or "excellent".You should write a constructor that allows the user to construct an apartment object by passing in values for all of the fields. You may assume that all attributes of the Apartment object will be defined. Therefore, there should be no default values for rent, metersFromUCSB, or condition.init(self, rent, metersFromUCSB, condition)In addition to your constructor, your class definition should also support “getter” methods that can receive the state of the Apartment object:getRent(self)getMetersFromUCSB(self)getCondition(self)You will also implement the methodgetApartmentDetails(self)that returns a str with all of the Apartment attributes. The string should contain all attributes in the following EXACT format (Note: There is no \n character at the end of this string):a0 = Apartment(1204, 200, "bad")print(a0.getApartmentDetails())Output(Apartment) Rent: $1204, Distance From UCSB: 200m, Condition: badLastly, your Apartment class should overload the >,<, and == operators. This will be used when finding the proper position of an Apartment in the list using the specifications in the Introduction section of this lab. In this context for example, the < operator will return True for Apartment1 < Apartment2 if Apartment1 is better than Apartment2. We reviewed operator overloading in class and the textbook does discuss overloading Python operators. You can also refer to this reference on overloading various operators as well:
Solution
The instructions are asking you to create three separate Python files: Apartment.py, lab06.py, and testFile.py.
In the Apartment.py file, you are to define a class for an Apartment object. The attributes for this object are rent (an integer), metersFromUCSB (an integer), and condition (a string that can be "bad", "average", or "excellent").
You need to write a constructor (init) that allows a user to create an Apartment object by passing in values for all of the fields.
You also need to write getter methods for each attribute: getRent, getMetersFromUCSB, and getCondition.
Additionally, you need to implement a method called getApartmentDetails that returns a string with all of the Apartment attributes in a specific format.
Finally, you need to overload the >, <, and == operators for the Apartment class. This will be used to compare Apartment objects.
In the lab06.py file, you are to define mergesort and other functions.
In the testFile.py file, you are to write pytest functions to test the correctness of your class definitions.
You should organize your work in its own directory for easy importation of files.
Similar Questions
Traceback (most recent call last): File "./main.py", line 44, in <module> print(mergeSort(arr, n)) File "./main.py", line 3, in mergeSort return _mergeSort(arr, temp_arr, 0, n-1)NameError: name '_mergeSort' is not defined
All your files, classes and methods must be unit tested and be PEP 8 validated.guillaume@ubuntu:~/$ python3 -m unittest discover tests.............................................................................................................................................................................................----------------------------------------------------------------------Ran 189 tests in 13.135sOKguillaume@ubuntu:~/$Note that this is just an example. The number of tests you create can be different from the above example.Repo:GitHub repository: alx-higher_level_programmingDirectory: 0x0C-python-almost_a_circleFile: tests/
Traceback (most recent call last): File "./main.py", line 43, in <module> print(mergeSort(arr,n)) File "./main.py", line 3, in mergeSort return _mergeSort(arr, temp_arr, 0, n-1)NameError: name '_mergeSort' is not defined
Traceback (most recent call last): File "main.py", line 41, in <module> mergeSort(arr, 0, N - 1) File "main.py", line 33, in mergeSort mergeSort(arr, l, m) File "main.py", line 33, in mergeSort mergeSort(arr, l, m) File "main.py", line 35, in mergeSort merge(arr, l, m, r) File "main.py", line 12, in merge if L[i] <= R[j]:NameError: name 'R' is not defined
Input65 1 3 15 10 4OutputTraceback (most recent call last): File "main.py", line 41, in <module> mergeSort(arr, 0, N - 1) File "main.py", line 33, in mergeSort mergeSort(arr, l, m) File "main.py", line 33, in mergeSort mergeSort(arr, l, m) File "main.py", line 35, in mergeSort merge(arr, l, m, r)NameError: name 'merge' is not defined
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.