diff options
Diffstat (limited to 'challenge-277/eric-cheung/python/ch-2.py')
| -rwxr-xr-x | challenge-277/eric-cheung/python/ch-2.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/challenge-277/eric-cheung/python/ch-2.py b/challenge-277/eric-cheung/python/ch-2.py new file mode 100755 index 0000000000..72b8faa3f6 --- /dev/null +++ b/challenge-277/eric-cheung/python/ch-2.py @@ -0,0 +1,16 @@ +
+from itertools import combinations
+
+def IsStrongPair (arrInput):
+ if abs(arrInput[0] - arrInput[1]) > 0 and min(arrInput) > abs(arrInput[0] - arrInput[1]):
+ return True
+ return False
+
+## arrInt = [1, 2, 3, 4, 5] ## Example 1
+arrInt = [5, 7, 1, 7] ## Example 2
+
+arrComb = combinations(arrInt, 2)
+
+arrOutput = [arrLoop for arrLoop in list(set(arrComb)) if IsStrongPair(arrLoop)]
+
+print (len(arrOutput))
|
