aboutsummaryrefslogtreecommitdiff
path: root/challenge-118/lubos-kolouch/python/ch-1.py
blob: e8fed3c65661bcdec15699f85520dca21dcad21f (plain)
1
2
3
4
5
6
7
8
9
10
11
#!/usr/bin/env python
# -*- coding: utf-8 -*-

def is_binary_palindrome(N):
    binary_rep = bin(N)[2:]
    return int(binary_rep == binary_rep[::-1])


# Tests
print(is_binary_palindrome(5))  # Output: 1
print(is_binary_palindrome(4))  # Output: 0