-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathintegerList.py
More file actions
43 lines (29 loc) · 907 Bytes
/
integerList.py
File metadata and controls
43 lines (29 loc) · 907 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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
from typing import List
class IntegerList:
def __init__ (self, inputList: List[int]):
self.list = inputList
print(self.list)
def FindProduct(self) -> int:
product = 1
for ii in self.list:
product *= ii
print(product)
return product
def MultiplyBy(self, multiplier: int) -> List[int]:
multipliedList = list()
for ii in self.list:
multipliedList.append(ii*multiplier)
return multipliedList
def FindEvenNumberss(self) -> List[int]:
evenList = list()
for ii in self.list:
if (ii % 2 == 0):
evenList.append(ii)
return evenList
def main() -> None:
myList = IntegerList([1, 2, 15, 1, 22])
print(myList.FindProduct())
print(myList.MultiplyBy(3))
print(myList.FindEvenNumberss())
if __name__ == "__main__":
main()