From 3a0d3971fee4f0e88baa2cf83e7a4a33b24ca8ec Mon Sep 17 00:00:00 2001 From: Mohammad S Anwar Date: Mon, 23 Jan 2023 01:51:15 +0000 Subject: - 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. --- challenge-200/eric-cheung/python/ch-1.py | 25 +++++++++++++++++++++++++ challenge-200/eric-cheung/python/ch-2.py | 11 +++++++++++ 2 files changed, 36 insertions(+) create mode 100755 challenge-200/eric-cheung/python/ch-1.py create mode 100755 challenge-200/eric-cheung/python/ch-2.py (limited to 'challenge-200/eric-cheung/python') 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)) -- cgit