Answered step by step
Verified Expert Solution
Question
1 Approved Answer
python (Put back @total ordering.) Input >>> 4 = Date(2020, 10, 21) >>> b = Date(2020, 9, 21) >>> C = Date(2020, 10, 21) >>>
python
(Put back @total ordering.) Input >>> 4 = Date(2020, 10, 21) >>> b = Date(2020, 9, 21) >>> C = Date(2020, 10, 21) >>> print(a b, a >= c, a == 0) in the Shell window to verify your code. 2. Suppose a pocket can contain two types of coins, a five pataca coin and a one pataca coin. We define the Pocket class to represent this kind of objects. class Pocket: Complete the following methods. a) A Pocket has two fields, fives and ones, to store the number of five pataca coins and the number of one pataca coins. The _init__(self, patacas) constructor initializes a Pocket object with the worth of coins equal to the given patacas, and with as many fives as possible. def _init_(self, patacas): b) The ger_worth(self) returns the worth of the coins the self object contains, in terms of patacas. def get worth(self): Input >>> print(Pocket(1000).get_worth() in the Shell window to verify your code. c) The str_(self) returns a string of form "MOP32(6.-2)' when the self object contains 6 fives and 2 ones. def str_(self): Input >>> print (Pocket(32))) in the Shell window to verify your code. d) The _add_(self, patacas) returns a new Pocket object with the total worth of coins equal to the sum of self and patacas. def _add_(self, patacas): Input >>> print (Pocket(32)+23) in the Shell window to verify your code. 2/3Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started