Python Program to find palindrome numbers in a list


In this program, You will learn how to find palindrome numbers in a list in Python.


data = [11, 12, 33, 44]

Example: How to find palindrome numbers in a list in Python

data = []
print("Enter how many number:", end="")
n = int(input())

print("Enter numbers:", end=" ")

for i in range(0, n):
    num = int(input())

    data.append(num)

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

for i in range(0, n):
    num = data[i]
    rev = 0
    while num > 0:
        r = num % 10
        rev = rev * 10 + r
        num = int(num / 10)

    if rev == data[i]:
        print(data[i], end=" ")

Output:

Enter how many number:4
Enter numbers: 11
12
121
146
Palindrome numbers are:11 121