Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a Python program, with the given Python files. o Enhancing Array-List: Enhance and implement a List ADT (with Array-based approach), by modifying our given
Write a Python program, with the given Python files. o Enhancing Array-List: Enhance and implement a List ADT (with Array-based approach), by modifying our given Python file AoneB.py (based on the one in our lecture notes, Alist.py) o Extra Operations (methods of the class) to be implemented by Students: At least one line of simple comment for each extra operation required Operation (AList) Description isEmptyL(): bool Check if the list is empty or not appendL(elt): Insert a new element elt into the end of the current list. removeLastL():elt Remove & return the last element elt of the list Return None in case of empty list searchL(elt):int Search & return the position of the first occurrence of an input searching element elt. * Position starts from 1. Return - 1 if not exist. o o Given Materials: Python file AoneB.py, to be modified and completed by student. Also modify top comments for your STUDENT INFO. (DO NOT modify this given portions, including given methods if any) Python file AoneBT.py for basic running and testing. DO NOT modify this given test file, except the STUDENT INFO part. File AoneB.py, to be modified and completed by student. # AoneB.py, for IDSA Assign 1 class Alist: # defining a class of Dynamic-Array-List # ... ############ STUDNET'S WORK ##### # simple comment HERE def isEmptyL(self): pass # TO BE DONE # AND MORE File Aonelt.py for basic running and testing # AoneCT.py, for basic running and testing. # * DO NOT modify this given test file, except the STUDENT INFO part. # Main Testing Program from Aone import Alist def main(): print("=== A1B, Enhanced ArrayList, by === ") myL = Alist) print(f"--- 1. New AL created, isEmptyL() result: {myl.isEmptyL()}") myL.insertL('A', 1); myL.insertL('C', 2); myL.append('ABC'); myl.append('D'); myL.appendL('B'); print(" --- 2. Finished Append(): A,C > ABC,D,B ---") myl.displayL() print(f" removeLastL(), elt is {myL.removeLastL()}") print(" --- 3. Finished removeLastL ---") myl.displayL() print(" --- 4. isEmptyL(), value: {myl.isEmptyL()}") print(" --- 5. searchl('ABC'), pos value: myL. searchL('ABC')}") print (f" --- 6. searchL 'XYZ'), pos value: {myl.searchL('XYZ')}") print(" === Program ends === ") main() Sample console display output of executing the main testing program Aonelt.py === A1B, Enhanced ArrayList, by === --- 1. New AL created, isEmptyL() result: True --- 2. Finished append(): A,C > ABC,D,B - >>> AList Display, with size/last, capacity A > C > ABC > D > B removeLastL(), elt is B --- 3. Finished removeLastL() --- >>> AList Display, with size/last, capacity A >> ABC > D --- 4. isEmptyL(), value: False --- 5. searchL('ABC'), pos value: 3 --- 6. searchl('XYZ'), pos value: -1 === Program ends ===
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started