13 lines
236 B
Python
13 lines
236 B
Python
from structure import Structure
|
|
|
|
|
|
class Stock(Structure):
|
|
_fields = ('name', 'shares', 'price')
|
|
|
|
@property
|
|
def cost(self):
|
|
return self.shares * self.price
|
|
|
|
def sell(self, nshares):
|
|
self.shares -= nshares
|