MCPcopy Create free account
hub / github.com/dabeaz-course/practical-python / cost

Method cost

Solutions/4_10/stock.py:15–19  ·  view source on GitHub ↗

Return the cost as shares*price

(self)

Source from the content-addressed store, hash-verified

13 return f'Stock({self.name!r}, {self.shares!r}, {self.price!r})'
14
15 def cost(self):
16 '''
17 Return the cost as shares*price
18 '''
19 return self.shares * self.price
20
21 def sell(self, nshares):
22 '''

Callers 1

portfolio_costFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected