Tansaction.py should contain a single class Transaction which encapsulates basic functionality of a single transaction.
It should contain the following properties:
product_list: list(Product)
environment_characteristic: string
place: string this is practically a bool (in or out) or it could be implemented as an enum.
date: datetime.date
__init__() should be implemented.
__repr__() could be implemented. The representation should be a string of the following form:
"(<date>, <environment_characteristic>, <place>, <product_list>)", where date could be any date (possibly not in the future), place depends on the implementation and a list of products (possibly should be checked if the list is empty, since it doesn't make any sense to have an empty product list in a transaction).
Example: a possible string representation of a transaction could be the following:
Main task
Tansaction.py should contain a single
class Transaction
which encapsulates basic functionality of a single transaction.It should contain the following properties:
product_list: list(Product)
environment_characteristic: string
place: string
this is practically a bool (in or out) or it could be implemented as anenum
.date: datetime.date
__init__()
should be implemented.__repr__()
could be implemented. The representation should be astring
of the following form:"(<date>, <environment_characteristic>, <place>, <product_list>)"
, wheredate
could be any date (possibly not in the future),place
depends on the implementation and a list of products (possibly should be checked if the list is empty, since it doesn't make any sense to have an empty product list in a transaction).Example: a possible string representation of a transaction could be the following:
"('2018/09/30', 'friends', 'in', [('pizza', 10.00), ('juice', 2.45)])"
Additional material
This material will help you implement all of the above.
enum