aboutsummaryrefslogtreecommitdiff
path: root/challenge-252/zapwai/python/ch-2.py
diff options
context:
space:
mode:
authorMohammad Sajid Anwar <Mohammad.Anwar@yahoo.com>2024-02-15 21:01:53 +0000
committerGitHub <noreply@github.com>2024-02-15 21:01:53 +0000
commitc9792b8a02f80c49e9bb4f0a1056c98d41e693a4 (patch)
tree290c0fe2def621c2f251befea6bd4086b6a9af84 /challenge-252/zapwai/python/ch-2.py
parentb4722f365b56ebb8a01ce4d4b136f16d26698cd6 (diff)
parent15ff62419201a3142b71d16cb5e919334a92d097 (diff)
downloadperlweeklychallenge-club-c9792b8a02f80c49e9bb4f0a1056c98d41e693a4.tar.gz
perlweeklychallenge-club-c9792b8a02f80c49e9bb4f0a1056c98d41e693a4.tar.bz2
perlweeklychallenge-club-c9792b8a02f80c49e9bb4f0a1056c98d41e693a4.zip
Merge pull request #9590 from zapwai/branch-for-recent-python
Recent Python scripts
Diffstat (limited to 'challenge-252/zapwai/python/ch-2.py')
-rw-r--r--challenge-252/zapwai/python/ch-2.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/challenge-252/zapwai/python/ch-2.py b/challenge-252/zapwai/python/ch-2.py
new file mode 100644
index 0000000000..998cba13e9
--- /dev/null
+++ b/challenge-252/zapwai/python/ch-2.py
@@ -0,0 +1,13 @@
+def proc(n):
+ print(f"Input : n = {n}")
+ l = []
+ if n % 2 == 1:
+ l.append(0)
+ k = int( (n - 1) / 2 )
+ val = 1
+ for i in range(k):
+ l.append(val); l.append(-1*val)
+ val += 1
+ print("Output:", l)
+for n in [5, 3, 1]:
+ proc(n)