Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/dabeaz-course/practical-python
/ cost
Method
cost
Solutions/4_4/stock.py:12–16 ·
view source on GitHub ↗
Return the cost as shares*price
(self)
Source
from the content-addressed store, hash-verified
10
self.price = price
11
12
def
cost(self):
13
''
&
#x27;
14
Return the cost
as
shares*price
15
''
&
#x27;
16
return
self.shares * self.price
17
18
def
sell(self, nshares):
19
''
&
#x27;
Callers
1
portfolio_cost
Function · 0.45
Calls
no outgoing calls
Tested by
no test coverage detected