aboutsummaryrefslogtreecommitdiff
path: root/challenge-252/eric-cheung/python/ch-2.py
diff options
context:
space:
mode:
authorDave Jacoby <jacoby.david@gmail.com>2024-01-22 13:51:41 -0500
committerDave Jacoby <jacoby.david@gmail.com>2024-01-22 13:51:41 -0500
commite214c9947ce77a42cf446c9abad0deaff401266e (patch)
treeffeda5fe0c5d114b0c827f144ea0c681ded80fcd /challenge-252/eric-cheung/python/ch-2.py
parent13ec6df65ba66ba1c002f8e2a4d8293c9f8f515f (diff)
parent8db85cd488ebedbbda40cca5403676ce0ed8e072 (diff)
downloadperlweeklychallenge-club-e214c9947ce77a42cf446c9abad0deaff401266e.tar.gz
perlweeklychallenge-club-e214c9947ce77a42cf446c9abad0deaff401266e.tar.bz2
perlweeklychallenge-club-e214c9947ce77a42cf446c9abad0deaff401266e.zip
Merge branch 'master' of https://github.com/manwar/perlweeklychallenge-club
Diffstat (limited to 'challenge-252/eric-cheung/python/ch-2.py')
-rwxr-xr-xchallenge-252/eric-cheung/python/ch-2.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/challenge-252/eric-cheung/python/ch-2.py b/challenge-252/eric-cheung/python/ch-2.py
new file mode 100755
index 0000000000..e943434336
--- /dev/null
+++ b/challenge-252/eric-cheung/python/ch-2.py
@@ -0,0 +1,10 @@
+
+## nInput = 5 ## Example 1
+## nInput = 3 ## Example 2
+## nInput = 1 ## Example 3
+nInput = 4 ## Example 4
+
+nMax = int(nInput / 2 if nInput % 2 == 0 else (nInput - 1) / 2)
+arrOutput = [nLoop for nLoop in range(-nMax, nMax + 1) if nLoop != 0 or nInput % 2 == 1]
+
+print (arrOutput)