Python Program to find palindrome numbers from an array


In this program, you will learn how to find palindrome numbers from an array in Python.


a = arr.array('i', [10, 11, 22, 25, 121, 123])

Example: How to find palindrome numbers from an array in Python

import array as arr

a = arr.array('i', [10, 11, 22, 25, 121, 123])

print("Palindrome list are : ", end=" ")

for i in a:
    rev = 0
    num = i
    while num > 0:
        r = num % 10
        rev = rev * 10 + r
        num = int(num / 10)

    if rev == i:
        print(i, end=" ")

Output:

Palindrome list are :  11 22 121