I have two files, multitest.py and skiplist.py We are given skiplist.py as starter code that we cannot edit.
multitest.py is the file I'm supposed to create and borrow the functions from skiplist.py
In the skiplist.py file, we have a method like
class SkipList(object):
def __len__(self):
"""(SkipList) -> int
Return the number of items in this skip list.
"""
return self.size
In multitest.py, I will have to create my own len method, but I am not allowed to access any built-ins.
from skiplist import *
class MultiSet(object):
def __len__(self):
"""(MultiSet) -> int
Return the number of items in this multiset.
"""
return SkipList.__len__(self)
When running
s = MultiSet([])
print(len(s))
I get the error
Traceback (most recent call last):
File "/Applications/WingIDE.app/Contents/MacOS/src/debug/tserver/_sandbox.py", line 134, in <module>
File "/Applications/WingIDE.app/Contents/MacOS/src/debug/tserver/_sandbox.py", line 56, in __len__
File "/Users/Borna/Documents/CSC148/Assignment/skiplist.py", line 39, in __len__
return self.size
builtins.AttributeError: 'MultiSet' object has no attribute 'size'
objectis a builtin, so...