class documentation

class Sequence:

View In Hierarchy

Our own version of collections.Sequence abstract base class.

Method __contains__ Return True if val found in the sequence; False otherwise.
Method __getitem__ Return the element at index j of the sequence.
Method __len__ Return the length of the sequence.
Method count Return the number of elements equal to given value.
Method index Return leftmost index at which val is found (or raise ValueError).
def __contains__(self, val):

Return True if val found in the sequence; False otherwise.

@abstractmethod
def __getitem__(self, j):

Return the element at index j of the sequence.

@abstractmethod
def __len__(self):

Return the length of the sequence.

def count(self, val):

Return the number of elements equal to given value.

def index(self, val):

Return leftmost index at which val is found (or raise ValueError).