## A class implementing Swaplist.

class Swaplist:
    """
    Fields: _data contains the items
            _length is the number of items stored
    """

    ## Swaplist(items) produces a swaplist with the items as data.
    ## __init__: (listof Any) -> Swaplist
    def __init__(self, items):
        self._data = items
        self._length = len(items)

    ## print(self) prints the sequence of values stored in self.
    ## Effect: Prints value
    ## __str__: Swaplist -> Str
    def __str__(self):
        return str(self._data)

    ## self == other produces True if the values and length
    ##     of self and other match.
    ## __eq__: Swaplist Swaplist -> Bool
    def __eq__(self, other):
        return self._data == other._data

    ## self.length() produces the length of self.
    ## length: Swaplist -> Int
    def length(self):
        return self._length

    ## self.look_up(position) produces the data item in the
    ##     given position in self.
    ## look_up: Swaplist Int -> Any
    ## Requires: 0 <= position < self.length()
    def look_up(self, position):
        return self._data[position]

    ## self.swap(position) swaps data items in positions
    ##     position and position + 1 in self.
    ## Effects: Mutates self.
    ## swap: Swaplist Int Int -> None
    ## Requires: 0 <= position < self.length()-1
    def swap(self, position):
        temp = self._data[position]
        self._data[position] = self._data[position + 1]
        self._data[position + 1] = temp
    
    
        
