Question: THIS IS PYTHON PLEASE LOOK OVER THIS CODE class DataHandler: def __init__(self,list_item): self.list = list_item def __len__(self): return len(self.list) def __sum__(self): return sum(self.list) def shape(self):

THIS IS PYTHON

THIS IS PYTHON PLEASE LOOK OVER THIS CODE class DataHandler: def __init__(self,list_item):

PLEASE LOOK OVER THIS CODE

class DataHandler: def __init__(self,list_item): self.list = list_item

def __len__(self): return len(self.list)

def __sum__(self): return sum(self.list)

def shape(self): return len(self.list)

def mean(self): sum1 = sum(self.list) n = len(self.list) self.mean = sum1 return self.mean

def variance(self): res = sum((i - self.mean) ** 2 for i in self.list) / len(self.list) self.var = res return self.var

def std(self): snDev = self.var**(1.0/2) self.snDev = snDev return self.snDev

l=[3,1,4,1,5,9] data = DataHandler(l) print(data.shape()) print(data.mean()) print(data.variance()) print(data.std())

THIS IS THE ERROR I GOT FROM THE CODE

Input In [12] def __init__(self,list_item): ^ IndentationError: expected an indented block

3. Wite a class named Datatlandler that achloves the following: - Its Linit () mothod aseions a liat to self. Iist - Its shape() mothod rotume the mumber of values in the list. - Its mean() method retums the avarage of the values in the llst. - Its vartance() method retums the variance of the values in the list. - Its std() mathod retums the standard deviation of the values in the liat. Formulae: Denote the list as [x1,x2,,xn], - The mean value is calculated as mean=nx1+x2++xn. - The variance is calculated as variance=n(x1mean)2+(x2mean)2++(xnmean)2. - The standard deviation is calculated as std=variance. Example: 11st1=[3,1,4,1,5,9]data=Datahandler(11st1)print(data.shape())print(data.mean())print(data.variance())print(data.std()) Output: 63.83333333333333357.472222222222221

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!