pylist delete def __delitem__(self,index)for in range(indexself numitems- )self items[iself items[ + self numitems - same as writing self numitems self numitems when deleting an item at specific index in the listwe must move everything after the item down to preserve our invariant that there are no holes in the internal list this results in (nimplementation in the average and worst case where is the number of items after the index in the list here is code that accomplishes deletion in the python interpreterto conserve spaceif list reaches point after deletion where less than half of the locations within the internal list are being usedthen the size of the available space is reduced by one half pylist equality test def __eq__(self,other)if type(other!type(self)return false if self numitems !other numitemsreturn false for in range(self numitems)if self items[ !other items[ ]return false return true checking for equality of two lists requires the two lists be of the same type if they are of different typesthen we'll say they are not equal in additionthe two lists must have the same length if they are not the same lengththey cannot be equal if these two preconditions are metthen the lists are equal if all the elements in the two lists are equal here is code that implements equality testing of two pylist objects equality testing is (noperation pylist iteration def __iter__(self)for in range(self numitems)yield self items[ithe ability to iterate over sequence is certainly requirement sequences hold collection of similar data items and we frequently want to do something with each item in sequence of coursethe complexity of iterating over any sequence is (nwhere is the size of the sequence here is code that accomplishes this for the pylist sequence the yield call in python suspends the execution of the __iter__ method and returns the yielded item to the iterator this copy belongs to 'acha