|
@@ -68,6 +68,8 @@ def find_even_index(arr):
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
|
|
|
class StatisticalSummary(object):
|
|
|
|
|
@@ -134,24 +136,82 @@ class StatisticalSummary(object):
|
|
|
print(q1)
|
|
|
print(q3)
|
|
|
return q1, q3
|
|
|
+
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-data = list(range(1, 33)) + list(range(12, 21)) + list(range(12, 21)) + list(range(12, 21)) + [16]
|
|
|
-d1 = list(range(1, 33)) + list(range(12, 21)) + list(range(12, 21)) + list(range(12, 21)) + [16]
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-d2 = [d - 2 for d in d1[:len(data)//2]] + [d + 2 for d in d1[len(data)//2:]]
|
|
|
-data2 = [("A", n) for n in d1] + [("B", n) for n in d2]
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-test_list = [1, 2, 5, 2, 3, 'asdfasd', 2, 3, 12, 45, 3, 6, 25, 54, 32, 12, 14]
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+def is_valid_walk(walk):
|
|
|
+ horizontl = 0
|
|
|
+ vertical = 0
|
|
|
+ for i in walk:
|
|
|
+ if i == 'n':
|
|
|
+ vertical += 1
|
|
|
+ elif i == 's':
|
|
|
+ vertical -= 1
|
|
|
+ elif i == 'w':
|
|
|
+ horizontl -= 1
|
|
|
+ elif i == 'e':
|
|
|
+ horizontl += 1
|
|
|
+
|
|
|
+ return vertical == 0 and horizontl == 0 and len(walk) == 10
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+def find_outlier(integers):
|
|
|
+ types = []
|
|
|
+
|
|
|
+ def is_even(value):
|
|
|
+ return value%2 == 0
|
|
|
+
|
|
|
+ for i in integers:
|
|
|
+ types.append(is_even(i))
|
|
|
+
|
|
|
+ if types.count(True) > types.count(False):
|
|
|
+ return integers[types.index(False)]
|
|
|
+ else:
|
|
|
+ return integers[types.index(True)]
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+def validate_pin(pin):
|
|
|
+ return len(pin) in (4, 6) and pin.isdigit()
|
|
|
|
|
|
-summary1 = StatisticalSummary(test_list)
|
|
|
-summary1.boxplot()
|
|
|
+
|