aboutsummaryrefslogtreecommitdiff
path: root/challenge-243/eric-cheung/python/ch-2.py
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-243/eric-cheung/python/ch-2.py')
-rwxr-xr-xchallenge-243/eric-cheung/python/ch-2.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/challenge-243/eric-cheung/python/ch-2.py b/challenge-243/eric-cheung/python/ch-2.py
new file mode 100755
index 0000000000..8d186c9bf5
--- /dev/null
+++ b/challenge-243/eric-cheung/python/ch-2.py
@@ -0,0 +1,13 @@
+
+from itertools import combinations
+
+def GetFloorSum (arrInput):
+ return int(arrInput[0] / arrInput[1]) + int(arrInput[1] / arrInput[0])
+
+## arrNum = [2, 5, 9] ## Example 1
+arrNum = [7, 7, 7, 7, 7, 7, 7] ## Example 2
+
+arrCombList = combinations(arrNum, 2)
+nSum = len(arrNum) + sum([GetFloorSum(arrLoop) for arrLoop in list(arrCombList)])
+
+print (nSum)