I created this small program. It should add to the cupboard some products. I get the following error:
TypeError: add_prod() missing 1 required positional argument: 'product'.
Here is the code:
class Products:
def __init__(self,nome):
self.nome = nome
class Cupboard:
def __init__(self):
self.prod = []
def add_prod(self, product):
self.prod.append(product)
def show(self):
print(self.prod)
p1 = Products("Ajax")
p2 = Products("Barilla")
Cupboard.add_prod(p1)
Cupboard.add_prod(p2)
show()