class PriceChecker():
# Constructor
def __init__(self):
self.levelsList = []
# Properties
@property
def levelsList(self):
return self.__levelsList
@levelsList.setter
def levelsList(self, newValue):
self.__levelsList = newValue
# Class Methods
# =============
# Method: Sort and Display the levelsList
def displayList(self):
print(chr(27) + "[2J") # Clear the screen
print("Price Levels In The List")
print("========================")
# Sort the list in reverse order
...
# Print the items in the list (Based on the above sort, numbers should appear from large to small.)
...
Instructions: Replace the ellipsis "..." with code
class PriceChecker():
# Constructor
def __init__(self):
self.levelsList = []
@property
def levelsList(self):
return self.__levelsList
@levelsList.setter
def levelsList(self, newValue):
self.__levelsList = newValue
def sortLevels(self):
self.__levelsList.sort()
# Class Methods
# =============
# Method: Sort and Display the levelsList
def displayList(self):
print(chr(27) + "[2J") # Clear the screen
print("Price Levels In The List")
print("========================")
# Sort the list in reverse order
return print(sortLevels())
# Print the items in the list (Based on the above sort, numbers should appear from large to small.
Comments
Leave a comment