Question: the arraylistiterator.py file complete the following: Complete the implementation of the ArraySortedListIterator ( ) class: Add the next ( ) method, returns the current item
the
arraylistiterator.py file complete the following:
Complete the implementation of the ArraySortedListIterator class:
Add the next method, returns the current item and advances the cursor to the next item and raises: ValueError if no next item.
Add the previous method, returns the current item and moves the cursor to the previous item and raises: ValueError if no next item.
Add the remove method, Pops the item at the current position and raises: AttibuteError if position is not defined.
Complete the implementation of the ArrayListIterator class:
Add the replace method, replaces the items at the current position with item and raises: AttibuteError if position is not defined
Add the insert method, adds item to the end if the current position is undefined, or inserts it at that position. Raises: AttributeError if illegal mutation of backing store
Make sure that both classes are functioning as expected by using the
testsortedlist.py and
testlistiterator.py files to test the implementations of each class.
Your program's output should look like the following:
Test below is on the
testsortedlist.pypy file.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
