class Vector :
# ...
def insert(position, element) :
assert index >= 0 and index <= self._length, "Index out of Range"
# If the underlying array is full, it has to be expanded
if self._length == len(self._theElements) :
self._expandArray()
# Shift the elements down to make room for the new element
i = self._length
while i > position :
self._theElements[i] = self._theElements[i - 1]
i = i + 1
# Insert the new element
self._theElements[position] = element
self._length = self._length + 1