diff options
| author | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2023-01-23 01:51:15 +0000 |
|---|---|---|
| committer | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2023-01-23 01:51:15 +0000 |
| commit | 3a0d3971fee4f0e88baa2cf83e7a4a33b24ca8ec (patch) | |
| tree | 8c67d01edbb6591029af2b3f44fba80427971172 /challenge-200/eric-cheung/python | |
| parent | 297f41de92d136922e9c85c2f8075966d6ef80ed (diff) | |
| download | perlweeklychallenge-club-3a0d3971fee4f0e88baa2cf83e7a4a33b24ca8ec.tar.gz perlweeklychallenge-club-3a0d3971fee4f0e88baa2cf83e7a4a33b24ca8ec.tar.bz2 perlweeklychallenge-club-3a0d3971fee4f0e88baa2cf83e7a4a33b24ca8ec.zip | |
- Added solutions by Roger Bell_West.
- Added solutions by Dave Jacoby.
- Added solutions by David Ferrone.
- Added solutions by Luca Ferrari.
- Added solutions by Mark Anderson.
- Added solutions by W. Luis Mochan.
- Added solutions by Peter Campbell Smith.
- Added solutions by Mariano Spadaccini.
- Added solutions by Thomas Kohler.
- Added solutions by Bob Lied.
- Added solutions by Jorg Sommrey.
- Added solutions by Flavio Poletti.
- Added solutions by Pip Stuart.
- Added solutions by E. Choroba.
- Added solutions by Stephen G. Lynn.
- Added solutions by Matthew Neleigh.
- Added solutions by Robert Ransbottom.
- Added solutions by Athanasius.
- Added solutions by Simon Green.
- Added solutions by Cheok-Yin Fung.
- Added solutions by Tyler Wardhaugh.
- Added solutions by Jan Krnavek.
- Added solutions by Bruce Gray.
- Added solutions by James Smith.
- Added solutions by Robbie Hatley.
- Added solutions by Solathian.
- Added solutions by Arne Sommer.
- Added solutions by Carlos Oliveira.
- Added solutions by Marton Polgar.
- Added solutions by Adam Russell.
- Added solutions by Duncan C. White.
- Added solutions by Lars Balker.
- Added solutions by Colin Crain.
- Added solutions by Laurent Rosenfeld.
- Added solutions by Robert DiCicco.
- Added solutions by Ulrich Rieke.
Diffstat (limited to 'challenge-200/eric-cheung/python')
| -rwxr-xr-x | challenge-200/eric-cheung/python/ch-1.py | 25 | ||||
| -rwxr-xr-x | challenge-200/eric-cheung/python/ch-2.py | 11 |
2 files changed, 36 insertions, 0 deletions
diff --git a/challenge-200/eric-cheung/python/ch-1.py b/challenge-200/eric-cheung/python/ch-1.py new file mode 100755 index 0000000000..74f509b821 --- /dev/null +++ b/challenge-200/eric-cheung/python/ch-1.py @@ -0,0 +1,25 @@ +
+## arrInput = [1, 2, 3, 4] ## Example 1
+arrInput = [2] ## Example 2
+
+def IsArithmetic(arrSubInput):
+
+ if len(arrSubInput) < 3:
+ return False
+
+ nDiff = arrSubInput[1] - arrSubInput[0]
+
+ for nLoop in range(2, len(arrSubInput)):
+ if arrSubInput[nLoop] - arrSubInput[nLoop - 1] != nDiff:
+ return False
+
+ return True
+
+arrOutput = []
+
+for nLen in range(3, len(arrInput) + 1):
+ for nIndx in range(0, len(arrInput) - nLen + 1):
+ if IsArithmetic(arrInput[nIndx:nIndx + nLen]):
+ arrOutput.append(arrInput[nIndx:nIndx + nLen])
+
+print (arrOutput)
\ No newline at end of file diff --git a/challenge-200/eric-cheung/python/ch-2.py b/challenge-200/eric-cheung/python/ch-2.py new file mode 100755 index 0000000000..e6ca0422eb --- /dev/null +++ b/challenge-200/eric-cheung/python/ch-2.py @@ -0,0 +1,11 @@ +
+## Remarks
+## https://pypi.org/project/sevseg/
+## https://inventwithpython.com/bigbookpython/project64.html
+##
+
+import sevseg
+
+nInput = 200
+
+print (sevseg.getSevSegStr(nInput, 1))
|
