aboutsummaryrefslogtreecommitdiff
path: root/challenge-120/abigail/python/ch-1.py
blob: 510ce33d105ebf1f4abd5626c6d41ce2d1e1d091 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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)