MCPcopy Create free account
hub / github.com/dabeaz-course/python-mastery / Stock

Class Stock

Solutions/3_1/stock.py:3–13  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1# stock.py
2
3class Stock:
4 def __init__(self, name, shares, price):
5 self.name = name
6 self.shares = shares
7 self.price = price
8
9 def cost(self):
10 return self.shares * self.price
11
12 def sell(self, nshares):
13 self.shares -= nshares
14
15def read_portfolio(filename):
16 '''

Callers 1

read_portfolioFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected