aboutsummaryrefslogtreecommitdiff
path: root/challenge-118/abigail/python/ch-1.py
blob: df0451a44ef816c569f1a4bc339f55523f7c4fc4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/opt/local/bin/python

#
# See ../README.md
#

#
# Run as: python ch-1.py < input-file
#

import fileinput

for line in fileinput . input ():
    bin = '{:b}' . format (int (line))     # Turn to binary representation
    if bin == bin [::-1]:                  # bin [::-1] reverse the string
        print (1)
    else:
        print (0)