aboutsummaryrefslogtreecommitdiff
path: root/challenge-120/abigail/python/ch-1.py
diff options
context:
space:
mode:
authorMohammad S Anwar <Mohammad.Anwar@yahoo.com>2021-07-06 00:34:58 +0100
committerGitHub <noreply@github.com>2021-07-06 00:34:58 +0100
commit4b13caca858d3e45ceccf1bfc2a567fc6c62458e (patch)
tree45562ac52d9777744e7f2f6f927c19407596bf13 /challenge-120/abigail/python/ch-1.py
parent495b4efc48550381635e1e63406ecdb2840995c5 (diff)
parent0242bf8e30c825fb37e1a19fb70e8d8b6a47957f (diff)
downloadperlweeklychallenge-club-4b13caca858d3e45ceccf1bfc2a567fc6c62458e.tar.gz
perlweeklychallenge-club-4b13caca858d3e45ceccf1bfc2a567fc6c62458e.tar.bz2
perlweeklychallenge-club-4b13caca858d3e45ceccf1bfc2a567fc6c62458e.zip
Merge pull request #4442 from Abigail/abigail/week-120
Abigail/week 120
Diffstat (limited to 'challenge-120/abigail/python/ch-1.py')
-rw-r--r--challenge-120/abigail/python/ch-1.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/challenge-120/abigail/python/ch-1.py b/challenge-120/abigail/python/ch-1.py
new file mode 100644
index 0000000000..510ce33d10
--- /dev/null
+++ b/challenge-120/abigail/python/ch-1.py
@@ -0,0 +1,16 @@
+#!/opt/local/bin/python
+
+#
+# See ../README.md
+#
+
+#
+# Run as: python ch-1.py < input-file
+#
+
+import fileinput
+
+for line in fileinput . input ():
+ num = int (line)
+ print ( (num & 0x55) << 1
+ | (num & 0xAA) >> 1)