Question: Please code in Python. I have done up till the size method in step one but I am not sure if its correct: here is
Please code in Python. I have done up till the size method in step one but I am not sure if its correct:


here is my code:
class SeqT:
def__init__(self){
SeqT=[];
}
def add(self, i, v){
SeqT[i] =v;
}
def rm(self, i){
del SeqT[i];
len.SeqT -1;
}
def set(self, I, v){
SeqT[i] = v;
}
def get(self, i){
SeqT[i] =v;
}
def size(){
sizeOf = len.SeqT;
return sizeOf;
}
def indexInSeq(self, v) {
}
import numpy
from SeqADT.py import *
class CurveT:
def__init__(self, String s)
Step 1 Write a first module that creates the Sequence ADT. It should consist of Python code in a file named SeqADT.py. The module should define a class SeqT, which contains the following class methods that define the external interface A constructor (SeqTO) that takes no arguments and creates an object whose state consists of an empty sequence. . A method named add(i, v) that takes the following inputs: i and v, where i (an integer) is the index where the value v (a real) should be added to the sequence. Values can only be added within the existing sequence, or immediately after the last entry in the existing sequence . A method named rm(i) that takes one argument: i (an integer). A call to this method modifies the sequence so that the entry at index i is removed. The length of the list will decrease by I. . A method named set(i, v) that takes two inputs: i (an integer) and v (a real) set is used to modity the entry in the sequence at index 2 to have the value v . A method named get(i) that takes on input: i (an integer). This method returns the value of the sequence at index i. A method named size() that takes no arguments and returns the current size (length) of the sequence (an integer) . A method named indexInSeq(v) that takes a real number v as input. For the sequence object s, indexInSeq returns the index i such that s.get(i) S v
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
