aboutsummaryrefslogtreecommitdiff
path: root/challenge-199/robert-dicicco/python
diff options
context:
space:
mode:
authorBob Lied <boblied+github@gmail.com>2023-01-14 06:30:38 -0600
committerGitHub <noreply@github.com>2023-01-14 06:30:38 -0600
commita2fcd3539045b5ff54ea81bc6cbec004c0f1fea7 (patch)
tree2891d52ef32c29b32d1b6ee5e40f879c74e1bd18 /challenge-199/robert-dicicco/python
parent060e309523bbbf50e6cb9684d858e7059344f31b (diff)
parent70a1571ce4c48f53a1eebc84eddb5c035f88b987 (diff)
downloadperlweeklychallenge-club-a2fcd3539045b5ff54ea81bc6cbec004c0f1fea7.tar.gz
perlweeklychallenge-club-a2fcd3539045b5ff54ea81bc6cbec004c0f1fea7.tar.bz2
perlweeklychallenge-club-a2fcd3539045b5ff54ea81bc6cbec004c0f1fea7.zip
Merge branch 'manwar:master' into master
Diffstat (limited to 'challenge-199/robert-dicicco/python')
-rw-r--r--challenge-199/robert-dicicco/python/ch-1.py95
1 files changed, 95 insertions, 0 deletions
diff --git a/challenge-199/robert-dicicco/python/ch-1.py b/challenge-199/robert-dicicco/python/ch-1.py
new file mode 100644
index 0000000000..1ef638bb42
--- /dev/null
+++ b/challenge-199/robert-dicicco/python/ch-1.py
@@ -0,0 +1,95 @@
+#!/usr/bin/env python
+
+'''
+
+AUTHOR: Robert DiCicco
+
+DATE : 2023-01-09
+
+Challenge 199 Good Pairs ( Python )
+
+'''
+
+
+lists = [[1,2,3,1,1,3],[1,2,3],[1,1,1,1]]
+
+finalCnt = 0
+
+
+for list in lists:
+
+ print(f"Input: @list = {list}")
+
+ beginner = 0
+
+ ender = len(list) - 1
+
+ cnt = beginner + 1
+
+ while beginner < ender:
+
+ while cnt <= ender:
+
+ if list[cnt] == list[beginner]:
+
+ print(f"{beginner},{cnt}")
+
+ finalCnt += 1
+
+ cnt += 1
+
+ beginner += 1
+
+ cnt = beginner + 1
+
+ print(f"Output: {finalCnt}\n")
+
+ finalCnt = 0
+
+      
+
+'''
+
+SAMPLE OUTPOUT
+
+python .\GoodPairs.py
+
+Input: @list = [1, 2, 3, 1, 1, 3]
+
+0,3
+
+0,4
+
+2,5
+
+3,4
+
+Output: 4
+
+
+Input: @list = [1, 2, 3]
+
+Output: 0
+
+
+Input: @list = [1, 1, 1, 1]
+
+0,1
+
+0,2
+
+0,3
+
+1,2
+
+1,3
+
+2,3
+
+Output: 6
+
+'''