(35, Α, 25) (32, Β, 23) (42, DE, 43) (45, E, 52) (15, F, 27) (18, H, 30) (36, XH, 51) (46, ZX, 5) (16, P, 20) (14,
EC, 10)
(35, Α, 25) (32, B, 23) (42, DE, 43) (45, E, 52) (15, F, 27) (18, H, 30) (36, XH, 51) (16, P, 20) (14, EC, 10)
def f4(self) - Sort price in descending order of all Products whose Id is an odd number, if the price of Products is same price, then sort name in ascending order. The other elements are unchanged.Output in this case like that:
OUTPUT
(-1, A, 5) (31, B, 23) (42, DE, 23) (45, E, 52) (21, F, 23) (18, H, 30) (31, XH, 23) (41, ZX, 5) (11, P, 23) (14,EC, 23)
(45, Ε, 52) (31, B, 23) (42, DE, 23) (21, F, 23) (11, P, 23) (18, H, 30) (31, XH, 23) (-1, A, 5) (41, ZX, 5) (14,EC, 23)
Question 2: (4 marks)
In this question you should complete some methods in BSTree.py files.
The class Product with 3 data members: Id, Name and Price is given and you do not need to edit it. The BSTree class is a binary search tree of Product objects. The variable Id is the key of the tree. The following
Zoom
+ 100%
Close