diff options
| author | boblied <boblied@gmail.com> | 2023-01-14 06:31:07 -0600 |
|---|---|---|
| committer | boblied <boblied@gmail.com> | 2023-01-14 06:31:07 -0600 |
| commit | ffd56fc1d6c761709c368e9742f06865c791b861 (patch) | |
| tree | 37db6124ba33ad9653ffb40951ca084702d8f395 /challenge-199/robert-dicicco/python | |
| parent | 66f0675baffc75d37a3b8e2093bebec84d8f9662 (diff) | |
| parent | a2fcd3539045b5ff54ea81bc6cbec004c0f1fea7 (diff) | |
| download | perlweeklychallenge-club-ffd56fc1d6c761709c368e9742f06865c791b861.tar.gz perlweeklychallenge-club-ffd56fc1d6c761709c368e9742f06865c791b861.tar.bz2 perlweeklychallenge-club-ffd56fc1d6c761709c368e9742f06865c791b861.zip | |
Merge branch 'master' of https://github.com/boblied/perlweeklychallenge-club
Diffstat (limited to 'challenge-199/robert-dicicco/python')
| -rw-r--r-- | challenge-199/robert-dicicco/python/ch-1.py | 95 |
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 + +''' |
