diff options
| author | boblied <boblied@gmail.com> | 2023-01-23 08:29:56 -0600 |
|---|---|---|
| committer | boblied <boblied@gmail.com> | 2023-01-23 08:29:56 -0600 |
| commit | c2de8f565b88096181337a6e2890c7ca4b6a6e9e (patch) | |
| tree | 2a692c38c3d7d3a842ecefd526dab448af534f66 /challenge-199/eric-cheung/python/ch-1.py | |
| parent | 109bfa578eb7dad7db280313e577f9ce3659175f (diff) | |
| parent | 27b88f614b9bb53872ef0da19a56087505836db0 (diff) | |
| download | perlweeklychallenge-club-c2de8f565b88096181337a6e2890c7ca4b6a6e9e.tar.gz perlweeklychallenge-club-c2de8f565b88096181337a6e2890c7ca4b6a6e9e.tar.bz2 perlweeklychallenge-club-c2de8f565b88096181337a6e2890c7ca4b6a6e9e.zip | |
Merge branch 'master' of https://github.com/boblied/perlweeklychallenge-club
Diffstat (limited to 'challenge-199/eric-cheung/python/ch-1.py')
| -rwxr-xr-x | challenge-199/eric-cheung/python/ch-1.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/challenge-199/eric-cheung/python/ch-1.py b/challenge-199/eric-cheung/python/ch-1.py new file mode 100755 index 0000000000..5227a2c7b1 --- /dev/null +++ b/challenge-199/eric-cheung/python/ch-1.py @@ -0,0 +1,20 @@ +
+from itertools import combinations
+
+def get_GoodPairs_List(arrInput):
+
+ arrGoodPairsList = []
+
+ nIndxTuple = combinations(range(0, len(arrInput)), 2)
+
+ for nIndxLoop_01, nIndxLoop_02 in list(nIndxTuple):
+ if arrInput[nIndxLoop_01] == arrInput[nIndxLoop_02]:
+ arrGoodPairsList.append([nIndxLoop_01, nIndxLoop_02])
+
+ return arrGoodPairsList
+
+## arrInputList = [1, 2, 3, 1, 1, 3] ## Example 1
+## arrInputList = [1, 2, 3] ## Example 2
+arrInputList = [1, 1, 1, 1] ## Example 3
+
+print (len(get_GoodPairs_List(arrInputList)))
|
