Skip to content

Commit c8e5a1a

Browse files
committed
Done 6.3
1 parent 6aebd14 commit c8e5a1a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Work/portfolio.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ def __init__(self, holdings):
55
def __iter__(self):
66
return self._holdings.__iter__()
77

8+
def __len__(self):
9+
return len(self._holdings)
10+
11+
def __getitem__(self, index):
12+
return self._holdings[index]
13+
14+
def __contains__(self, name):
15+
return any([s.name == name for s in self._holdings])
16+
817
@property
918
def total_cost(self):
1019
return sum([s.cost for s in self._holdings])

0 commit comments

Comments
 (0)