forked from YousifGamal/Behave-SoftwareTesting
-
Notifications
You must be signed in to change notification settings - Fork 0
/
number.py
80 lines (66 loc) · 2 KB
/
number.py
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
class Numbers:
def __init__(self, a=None, b=None):
self.a = a
self.b = b
self.divisor = None
self.result = None
self.numbers = []
def add(self):
return self.a + self.b
def sub(self):
return self.a - self.b
def working_merge_lists_sorted(self):
pt1 = 0
pt2 = 0
result = []
while(pt1 < len(self.a) and pt2 < len(self.b)):
if self.a[pt1] < self.b[pt2]:
result.append(self.a[pt1])
pt1 += 1
else:
result.append(self.b[pt2])
pt2 += 1
for i in range(pt1, len(self.a)):
result.append(self.a[pt1])
for i in range(pt2, len(self.b)):
result.append(self.b[pt2])
return result
def divison(self):
return self.a / self.b
return result
def wrong_merge_lists_sorted(self):
pt1 = 0
pt2 = 0
result = []
while(pt1 < len(self.a) and pt2 < len(self.b)):
if self.a[pt1] < self.b[pt2]:
result.append(self.b[pt1])
pt1 += 1
else:
result.append(self.b[pt2])
pt2 += 1
for i in range(pt1, len(self.a)):
result.append(self.a[pt1])
for i in range(pt2, len(self.b)):
result.append(self.b[pt2])
return result
def get_total_sum(self):
return sum(self.a) + sum(self.b)
def divisonDecision(self):
if self.divisor == "zero":
return "skip"
else:
return "complete"
def getMax(self):
self.result = max(self.numbers)
def getMin(self):
self.result = min(self.numbers)
def factorial(self):
if self.a == 0:
self.result = 1
return
else:
result = 1
for i in range(self.a):
result = result * (i + 1)
self.result = result