Esempio n. 1
0
File: p03x.py Progetto: jpaeng/PE
def double_base_palindromes(max_n):
    """ Return a list of all decimal-binary palindromes up to max_n."""
    palindromes = []
    for n in range(1, max_n + 1, 2):    # binary palindromes must be odd
        if common.is_str_palindrome(str(n)) and common.is_str_palindrome(bin(n)[2:]):
            palindromes.append(n)
    return palindromes
Esempio n. 2
0
File: p00x.py Progetto: jpaeng/PE
def is_num_palindrome(n):
    if n < 10:
        return True
    else:
        return common.is_str_palindrome(str(n))