-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcalcList.py
More file actions
25 lines (25 loc) · 763 Bytes
/
calcList.py
File metadata and controls
25 lines (25 loc) · 763 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
class calcList():
def __init__(self,inputData=[]):
self.data = list(inputData)
def __mul__(self,a):
tmp = []
for i in range(len(self.data)):
tmp.append(a*self.data[i])
return calcList(tmp)
def __add__(self,a):
tmp = []
for i in range(len(self.data)):
tmp.append(a+self.data[i])
return calcList(tmp)
def __truediv__(self,a):
return self.__mul__(1/a)
def __floordiv__(self,a):
tmp = []
for i in range(len(self.data)):
tmp.append(self.data[i]//a)
def __iter__(self):
return self.data.__iter__()
def __repr__(self):
return self.data.__repr__()
def __append__(self,a):
return self.data.append(a)