Defining the sequence of methods
Defining the methods helps us in understanding each of the operations performed at each counter in detail. Let’s define the classes and methods required to fulfill the actions to be performed in each operation. We will be covering the following counters in this section:
- The vegetable counter
- Less than 10 items counter
- Greater than 10 items counter
- The electronics counter
Let’s begin with the vegetable counter.
The vegetable counter
The following are the steps for the operation of this counter:
- We will first create the
VegCounter
class as follows:class VegCounter():
- In the following code, we will be defining the
return_cart
method that returns the list of items added to the shopping cart:def return_cart(self,*items): cart_items = list(items) return cart_items
- Let’...